Declarations

Beside QM intrinsic functions, you can also use functions from Windows dlls, as well as from other dlls (e.g. downloaded). Dll functions, together with types and constants that are used with them, are called Application Programming Interface, or API. Windows API are documented in MSDN library. Before using, they must be declared. Otherwise QM would be unable to find functions, perform type checking, retrieve values of constants, etc.

 

You can place declarations in the same macro/function where used, or in other functions that were executed or compiled before. For example, you can place them in init2 function (if does not exist - create), which is executed at startup, or in some function that has "QM file loaded" trigger. It is not error if identical declarations are in more than one place. Read more.

 

All declared identifiers have global scope (except local and thread variables), and can be used in any macro. They are listed in the popup list that appears when you type dot (.). In code they are colored. You also can see them in QM status bar.

 

Some Windows API functions, types, constants and interfaces are declared by default. You don't need to declare them. Some of them are declared internally, others in the System folder. Many other declarations are in WINAPI and WINAPIV reference files, and you also don't have to declare these identifiers. In the QM forum you can find and download another file that contains more declarations.

 

Many other declarations are in other reference files and in type libraries. You don't have to explicitly declare those identifiers. Just type a library name, dot (.), and double click the identifier in the popup list. That is, use syntax libname.identifier. QM reference files are supported only by QM, but type libraries are supported by most programming languages. Type libraries are mostly used to describe COM components. Many type libraries are already installed. Installed type libraries are listed in the COM Libraries dialog. Many free and commercial components with/and type libraries are available on the Internet. Type libraries and reference files must be declared (typelib, ref), unless they are declared by default. Declared reference files and type libraries are listed at the bottom of the global popup list.

 

Below are listed all kinds of identifiers supported by QM.

  Declaration Name examples
QM intrinsic functions   lef, if
User-defined functions function MyFunction
Dll functions dll GetCursorPos
QM intrinsic types, OLE types   int, BSTR
User-defined types type LOGFONT
Classes class Ftp
COM classes Declared in type libraries. WshNetwork
COM interfaces Declared in type libraries. Also can be used interface. IHTMLElement
Named constants def WM_USER
COM type libraries typelib Shell32
API reference files ref WINAPI
Categories category internet
Compiler directives   #ifdef
     
Variables Type name i
     
Member functions of intrinsic types   getwintext
Member functions of classes Name is declared by using special syntax in QM item name. To declare type and parameters, use function. SetValue
Methods
(member functions of COM interfaces)
Declared in type libraries. Also can be used interface. GoBack
Properties
(member functions of COM interfaces)
Declared in type libraries. Also can be used interface. Height
     
Events
(user-defined functions called by COM object)
Declared in type libraries. a_Activate

 

These identifiers can be declared in type libraries: COM classes, COM interfaces, user-defined types, dll functions, named constants, enumerations. Enumerations are not used in QM, but constants from them can be used.

 

These identifiers can be declared in reference files: dll functions, user-defined types, classes, categories, COM interfaces, named constants, type libraries.