_i - variable of type int. It is normal local variable except that you don't have to declare it.
_s - variable of type str. The same as above.
_dir, _findt, _findl, _gett, _getl are used by corresponding functions.
this - reference to object (variable) for which current member-function is called.
Most of these variables normally are populated by QM, but you also can use them.
_command - command string of current thread. Type - lpstr. If thread started without command, it is 0. See also: mac, QM command line.
_hresult - last called COM function's error code. Some other functions also use it.
_error - error info.
_monitor - monitor where various functions display dialogs, on-screen text, etc. A macro can change it to display them in certain monitor. Possible values:
0 (default) - depends on context. In most cases - primary monitor. If dialog owner window specified - owner's monitor. With ShowDialog, also depends on dialog style.
1-30 - monitor index.
-1 - monitor from mouse.
-2 - monitor from active window.
-3 - primary monitor.
Or can be handle of a window whose monitor must be used.
If _monitor's value is invalid (invalid index, handle, etc), is used the primary monitor.
_monitor is applied to these functions: mes, list, inp, inpp, OnScreenDisplay, ShowDialog, and most functions that use them. Some other functions either have a monitor parameter instead, or a flag that tells to use _monitor.
display message box in monitor 2 _monitor=2 mes "text" display on-screen text in monitor with the mouse pointer, and restore the variable _i=_monitor; _monitor=-1 OnScreenDisplay "text" _monitor=_i
Also there are 10 int variables tls0 ... tls9, for backward compatibility.
_winnt - Windows NT major version. Value:
0 - non-NT OS (98/Me). Obsolete. QM 2.3.0 and later QM versions don't run on these OS.
5 - 2000/XP/2003
6 - Vista/Windows 7
_winver - Windows version. Value:
0x500 - 2000 (5.0)
0x501 - XP (5.1)
0x502 - 2003 (5.2)
0x600 - Vista (6.0)
0x601 - Windows 7 (6.1)
_iever - Internet Explorer version. Value:
0x500 - IE 5
0x532 - IE 5.50
0x600 - IE 6
0x700 - IE 7
0x800 - IE 8
These values are in hexadecimal format. To display a value in hexadecimal format, use code like this:
out "0x%X" _winver
QM also defines constants WINNT, WINVER and IEVER. In macros running in QM they have the same values as _winnt, _winver and _iever. In macros compiled to exe, the variables contain values for the computer where the program is running, whereas the constants have values for the computer where the program was compiled. In macros that will be compiled to exe and distributed, consider using variables (not constants) and if (not #if).
_win64 (QM 2.2.0) - 0 on 32-bit Windows, 1 on 64-bit Windows. Note: QM is 32-bit, but runs on 64-bit Windows too. See also: IsWindow64Bit.
_unicode (QM 2.3.0) - Unicode mode. Nonzero if QM is running in Unicode mode (checked Options -> General -> Text: Unicode). It is equal to the default code page that is used with str.ansi and str.unicode, i.e. CP_ACP (0) in ANSI mode or CP_UTF8 (65001) in Unicode mode.
_hwndqm - QM main window handle. In exe it is handle of a hidden window that is created in the primary thread of the process (not the thread that executes the macro).
_hinst - qm.exe module handle (HMODULE or HINSTANCE). In exe it is handle of the exe file. If you need module handle (or instance handle, which is the same) to use with API resource functions that will be used in exe, instead use GetExeResHandle, which also allows you to use these resources when debugging (when the macro runs in QM, not as exe).
_logfile - default log file used by LogFile. Default is "qm log.txt" in My Documents\My QM. In exe, default is "exename log.txt" in program's folder. You can change it.
_logfilesize - maximal size of log file used by LogFile. Default is 1 MB. You can change it.
_qmdir - QM path without filename. Ends with \. Same as expanded "$qm$\". In exe it is exe path. To get path with filename, use ExeFullPath.
_qmver_str - QM version string (QMVER as string).
QM 2.3.2: All the global predefined variables except _logfile and _logfilesize are read-only.
See also: more types of storage predefined constants make exe