Executing Macros in a WinHelp Function Call

An application can send a HELP_COMMAND parameter in the WinHelp function call that specifies a macro to execute. The WinHelp function uses the following C-language syntax:

BOOL WinHelp (hWnd, lpHelpFile[>WindowName], wCommand, dwData)

When sending a macro request, the dwData parameter should point to a null-terminated string that contains the macro. The macro string can have as many as 255 characters.

The following example uses a Help macro to specify the context string IDM_HELP_KEYBOARD for the Keyboard topic in MYHELP.HLP:

case IDM_HELP_KEYBOARD:
    WinHelp (hWnd, "myhelp.hlp", HELP_COMMAND,
           (LPSTR) "JumpID(\"myhelp.hlp\",\"IDM_HELP_KEYBOARD\")");
    return 0L;

For more information about the WinHelp function, see Chapter 19, “The WinHelp API.”