This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Default main function
thinBasic implements an optional "main function" logic.
If script contains a function called TBMain and during the script execution TBMain was not called by direct invocation, thinBasic will execute TBMain automatically.
TBMain is like the "main" function in C programming language.
TBMain template is like the following:
Function TBMain() As Long
...
Function = <TBMain Return value>
End Function
Value returned by TBMain will be used to pass script return code to the calling process or to the operating system.
If script uses APP_SetReturnCode, TBMain return code will have an higher priority over it and will be used instead.
Using Return statement from inside TBMain, will terminate the script and optionally returning a value propagated to exit code
Is TBMain mandatory?
No, it is not mandatory. A script can or can not contains a TBMain function. It is up to programmer to use this feature or not.
I do not like TBMain name. Can I change it?
Yes, you can set up any script function as main function (at anytime during script execution) using APP_SetEntryPoint and APP_GetEntryPoint