15.2 Help Macro Syntax

Windows Help macros specify actions that Windows Help takes when it loads Help or displays a topic. (Help macros can also be executed when the user selects a hot spot or clicks on a designated segmented graphic.) A Help macro consists of a macro name and parameters enclosed in parentheses.

Macro names specify the action to take, such as creating buttons or inserting menu items. The names are not sensitive to case, so any combination of uppercase and lowercase letters may be used.

Macro parameters specify the files, buttons, menus, or topics on which to carry out the action. The parameters must be enclosed in parentheses and separated by spaces. Parameters in many macros must also be enclosed in quotation marks. This is especially true if the parameter contains space characters. The valid quotation characters are the matching double quotation marks (" ") and the opening and closing single quotation marks (` '). If a quotation character is needed as part of a parameter, the parameter should be enclosed in single quotation marks. When using single quotation marks in this manner, you can omit the backslash escape character for the double quotation marks, as shown in the following example:

`command "string as parameter"'

Macros can be used as parameters in other macros. In most cases, embedded macros must be enclosed in quotation marks. If the embedded macro also has quoted parameters, the quotation character that is used must be different than the quotation characters enclosing the macro. The following example shows the correct way to use nested quotation marks:

CreateButton("time_btn", "&Time", "ExecProgram(`clock', 0)")

A Help macro and all of its parameters must not exceed 512 characters.

Help macros can be combined into macro strings by separating the macros with semicolons (;). The Microsoft Help Compiler processes the macro string as a unit and executes the individual macros sequentially.