Define named constant

Syntax

def name value

 

Parts

name - constant's name.

value - constant's value. Can be constant value of any type (number, string), or any other expression. Can include nonconstant values (global variables, functions).

 

Remarks

Defines a named constant. A named constant is a meaningful name that takes the place of a number, string or other expression. It is similar to a variable, but cannot be modified. It has global scope, i.e. can be used in any macro.

 

Often you'll find that your code contains numbers or strings that are used for certain purpose. You can improve the readability of your code, and make it easier to maintain, by using named constants instead.

 

Named constants also can be defined in reference files and type libraries, which allows you to use them without defining explicitly. Many definitions are in WINAPI and WINAPIV reference files. Usage example:

 

out WINAPI.ERROR_BAD_PATHNAME

 

Some Windows constants are defined by default, in the System\Declarations folder.

 

There are several constants defined by QM.

 

See also: declarations scope

 

Examples

def MAX_PATH 260
def GMEM_SHARE 0x2000
def dblconst -1.25
def strconst "String constant"
def GPTR GMEM_FIXED|GMEM_ZEROINIT
def A10 A + 10
def IID_IShellFolder uuidof("{000214E6-0000-0000-C000-000000000046}")