#exe option value [resid]
| option | value | Description |
|---|---|---|
| addfunction | Function name. | Adds the user defined function. Usually this is not necessary because all required functions are added automatically, but in some cases QM cannot know what function must be added. For example, if with mac you use function name as string in quotes, the function is added automatically, but if you use a variable, QM cannot know what function will be used, and displays a warning. Then you must use #exe. |
| addtextof | QM item name. | Adds text of the QM item. The item can be of any type. Usually this is not necessary because all required items are added automatically, but in some cases QM cannot know what item must be added. For example, QM automatically adds text of items that are used with str.getmacro (directly or by other functions like ShowDialog), but if you use a variable for item name, QM cannot know what item will be used, and displays a warning. Then you must use #exe. |
| addactivex | ActiveX control class in form Typelib.Class. | Adds information about an ActiveX control class. Usually this is not necessary because QM automatically adds information about ActiveX controls used in dialogs. You only need to use addactivex if you create ActiveX controls using CreateWindowEx or CreateControl (where window class is "ActiveX"), or create dialog definition at run time. QM 2.2.0: and only if class id is not included, ie window name is just Typelib.Class, without {clsid}. |
| addfile | File path. Can be full or relative to the folder where the exe file will be created. | QM 2.2.0. Adds a file to exe resources. resid must be a unique value between 1 and 0x7FFF. When the exe runs, it can extract the file with ExeExtractFile or get file data with ExeGetResourceData. The resource type is RT_RCDATA (10).
QM 2.3.0. Instead can be used syntax ":resourceid filepath" with file functions. Read more. Also, can be used str.getfile to get the data. |
Explicitly adds a function, text, ActiveX control class or a file to exe. Ignored if compiling not for exe. Can be used in any place.
To disable warnings, use #opt nowarnings 1.
#exe addfunction "Function5" #exe addtextof "Macro5" #exe addactivex "Typelib.Class" _______________________________________________ Adds a dll to exe, at run time extracts it to the temp folder, and calls a function. This code can run in QM too. Note 1: Before making exe or running this code in QM, copy the dll to the folder. Note 2: Must be used delay loading (dll-). def _DLL_TEMP_ATL "$temp$\testexe\atl.dll" #if EXE #exe addfile _DLL_TEMP_ATL 10 ;;add dll to exe (when making exe) if(!ExeExtractFile(10 _DLL_TEMP_ATL 0)) ret ;;extract dll from exe #endif declare dll function dll- _DLL_TEMP_ATL AtlPixelToHiMetric SIZEL*lpSizeInPix SIZEL*lpSizeInHiMetric call dll function SIZEL pix him pix.cx=1 AtlPixelToHiMetric &pix &him ;;convert pixels to himetric units, which is 0.01 mm out him.cx _______________________________________________ Code for a dll that does not have functions. Just loads the dll. This code is from function ExeQmGridDll. #if EXE #exe addfile "$qm$\qmgrid.dll" 10 ;;add dll to exe (when making exe) if !GetModuleHandle("qmgrid.dll") str sDir.expandpath(F"$temp$\qm\0x{QMVER}") sDll.from(sDir "\qmgrid.dll") if !dir(sDll) ;;if qmgrid.dll of this QM version is not already there if(!ExeExtractFile(10 sDll)) ret ;;extract dll from exe; also creates folders. if(!LoadLibraryW(@sDll)) ret ;;load explicitly #endif