WinHelpWinHelp*
*



Contents  *



Index  *Topic Contents
*Previous Topic: VwStreamTellFunc
*Next Topic: Callback Functions

WinHelp

Starts Microsoft® Windows® Help (Winhelp.exe) and passes additional data indicating the nature of the Help requested by the application.

Syntax


BOOL WinHelp(
    HWND hWndMain,
    LPCTSTR lpszHelp,
    UINT uCommand,
    DWORD dwData
);

Parameters

hWndMain
Identifies the window requesting Help. The WinHelp function uses this handle to keep track of which applications have requested Help. If the uCommand parameter specifies HELP_CONTEXTMENU or HELP_WM_HELP, hWndMain identifies the control requesting Help.
lpszHelp
Address of a null-terminated string containing the path, if necessary, and the name of the Help file that WinHelp is to display.

The file name may be followed by an angle bracket (>) and the name of a secondary window if the topic is to be displayed in a secondary window rather than in the primary window. The name of the secondary window must have been defined in the [WINDOWS] section of the Help project (.hpj) file.

uCommand
Type of Help requested. For a list of possible values and how they affect the value to place in the dwData parameter, see the Remarks section.
dwData
Additional data. The value used depends on the value of the uCommand parameter. For a list of possible values, see the Remarks section.

Return Values


Returns nonzero if successful, or zero otherwise.

To get extended error information, call GetLastError.

Remarks


Before closing the window that requested Help, the application must call WinHelp with the uCommand parameter set to HELP_QUIT. Until all applications have done this, Windows Help will not terminate. Note that calling Windows Help with the HELP_QUIT command is not necessary if you used the HELP_CONTEXTPOPUP command to start Windows Help.

The following table shows the possible values for the uCommand parameter and the corresponding formats of the dwData parameter.
uCommandActiondwData
HELP_COMMANDExecutes a Help macro or macro string. Address of a string that specifies the name of the Help macro(s) to run. If the string specifies multiple macro names, the names must be separated by semicolons. You must use the short form of the macro name for some macros because Windows Help does not support the long name.
HELP_CONTENTSDisplays the topic specified by the Contents option in the [OPTIONS] section of the .hpj file. This command is for backward compatibility. New applications should provide a .cnt file and use the HELP_FINDER command. Ignored, set to 0.
HELP_CONTEXTDisplays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file. Unsigned long integer containing the context identifier for the topic.
HELP_CONTEXTMENUDisplays the Help menu for the selected window, then displays the topic for the selected control in a pop-up window. Address of an array of double word pairs. The first double word in each pair is a control identifier, and the second is a context number for a topic.
HELP_CONTEXTPOPUPDisplays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file in a pop-up window. Unsigned long integer containing the context identifier for a topic.
HELP_FINDERDisplays the Help Topics dialog box. Ignored; set to 0.
HELP_FORCEFILEEnsures that Windows Help is displaying the correct Help file. If the incorrect Help file is being displayed, Windows Help opens the correct one; otherwise, there is no action. Ignored, set to 0.
HELP_HELPONHELPDisplays Help on how to use Windows Help, if the WINHLP32.HLP file is available. Ignored, set to 0.
HELP_INDEXDisplays the topic specified by the Contents option in the [OPTIONS] section of the .hpj file. This command is for backward compatibility. New applications should use the HELP_FINDER command. Ignored, set to 0.
HELP_KEYDisplays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than one match, displays the Index with the topics listed in the Topics Found list box. Address of a keyword string. Multiple keywords must be separated by semicolons.
HELP_MULTIKEYDisplays the topic specified by a keyword in an alternative keyword table. Address of a MULTIKEYHELP structure that specifies a table footnote character and a keyword.
HELP_PARTIALKEYDisplays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than one match, displays the Topics Found dialog box. To display the Index without passing a keyword, you should use a pointer to an empty string. Address of a keyword string. Multiple keywords must be separated by semicolons.
HELP_QUITInforms Windows Help that it is no longer needed. If no other applications have asked for Help, Windows closes Windows Help. Ignored, set to 0.
HELP_SETCONTENTSSpecifies the Contents topic. Windows Help displays this topic when the user clicks the Contents button if the Help file does not have an associated .cnt file. Unsigned long integer containing the context identifier for the Contents topic.
HELP_SETPOPUP_POSSets the position of the subsequent pop-up window. Address of a POINTS structure. The pop-up window is positioned as if the mouse cursor were at the specified point when the pop-up window is invoked.
HELP_SETWINPOSDisplays the Help window, if it is minimized or in memory, and sets its size and position as specified. Address of a HELPWININFO structure that specifies the size and position of either a primary or secondary Help window.
HELP_TCARDIndicates that a command is for a training card instance of Windows Help. Combine this command with other commands using the bitwise OR operator. Depends on the command with which this command is combined.
HELP_WM_HELPDisplays the topic for the control identified by the hWndMain parameter in a pop-up window.Address of an array of double word pairs. The first double word in each pair is a control identifier, and the second is a context identifier for a topic.

See Also


HELPWININFO, MULTIKEYHELP


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.