Compiler directives: #exe

Syntax

#exe option value [resId] [resType]

 

Parameters

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, with mac, if function name is variable, QM cannot know what function will be used, and displays a warning. Then use #exe.
addtextof QM item name.

Adds text of the QM item (macro, function, etc). 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, with str.getmacro, if macro name is variable, QM cannot know what macro will be used, and displays a warning. Then use #exe.

 

Automatically adds text of items used with ShowDialog (item containing dialog definition or/and menu definition), scripting functions (item containing script), scan "macro:..." (item containing bitmap), wait S "macro:..." and some other functions.

 

QM 2.3.5. Also automatically adds text of items from all string constants like "macro:MacroName". Previously this would work only with scan and wait. Multiple items can be added with code like this: _s="macro:Macro1[]macro:Macro2".

 

QM 2.3.5. If value is "<script>", adds caller's text if it calls current function with first argument "", like VbsExec "".

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 - resource id, 1 to 0xFFFF. Must be unique in resources of this type. Can be string (QM 2.4.0).

resType (QM 2.3.4) - resource type. Can be integer 1 to 0xFFFF (eg RT_BITMAP) or string (eg "WAVE"). Default (0): RT_RCDATA.

 

At run time you can extract the file with ExeExtractFile, or get file data with ExeGetResourceData, or use a Windows API function that supports resources.

 

QM 2.3.0. Instead can be used syntax ":resourceid filepath" with file functions. Read more. Also, can be used str.getfile to get data.

 

QM 2.4.1. Can add a macro resource. See example.

 

Remarks

Explicitly adds a function, text, ActiveX control class or a file to exe. Ignored if the macro runs in QM. Can be used in any place.

 

To disable warnings, use #opt nowarnings 1.

 

Examples

#exe addfunction "Function5"
#exe addtextof "Macro5"
#exe addactivex "Typelib.Class"
#exe addfile "$my qm$\copy.bmp" 10 RT_BITMAP
#exe addfile "resource:app.ico" 10 RT_GROUP_ICON

 

See also code in function ExeQmGridDll. It adds a dll to exe, and extracts/loads at run time.