WinHelp

  BOOL WinHelp(hwnd, lpszHelpFile, fuCommand, dwData)    
  HWND hwnd; /* handle of window requesting help */
  LPCTSTR lpszHelpFile; /* address of directory-path string */
  UINT fuCommand; /* type of help */
  DWORD dwData; /* additional data */

This function invokes the Windows Help application and passes optional data indicating the nature of the help requested by the application. The application specifies the name and, where required, the directory path of the help file which the Help application is to display.

Parameters

hwnd

Identifies the window requesting help.

lpszHelpFile

Points to a null-terminated string containing the directory path, if needed, and the name of the help file which the Help application is to display.

fuCommand

Specifies the type of help requested. It may be any one of the following values:

Value Meaning

HELP_CONTEXT  
  Displays help for a particular context identified by an WORD integer value in dwData.
HELP_HELPONHELP  
  Displays help for using the help application itself. If the fuCommand parameter is set to HELP_HELPONHELP, WinHelp ignores the lpszHelpFile and dwData parameters.
HELP_INDEX  
  Displays the index of the specified help file. An application should use this value only for help files with a single index. It should not use this value with HELP_SETINDEX.
HELP_MULTIKEY  
  Displays help for a key word in an alternate keyword table.
HELP_QUIT  
  Notifies the help application that the specified help file is no longer in use.
HELP_SETINDEX  
  Sets the context specified by the dwData parameter as the current index for the help file specified by the lpszHelpFile parameter. This index remains current until the user accesses a different help file. To help ensure that the correct index remains set, the application should call WinHelp with fuCommand set to HELP_SETINDEX (with dwData specifying the corresponding context identifier) following each call to WinHelp with fuCommand set to HELP_CONTEXT. An application should use this value only for help files with more than one index. It should not use this value with HELP_INDEX.

dwData

Specifies the context or key word of the help requested. If fuCommand is HELP_CONTEXT, dwData is an WORD integer containing a context-identifier number. If fuCommand is HELP_KEY, dwData is a pointer to a null-terminated string that contains a key word identifying the help topic. If fuCommand is HELP_MULTIKEY, dwData is a pointer to a MULTIKEYHELP structure. Otherwise, dwData is ignored and should be set to NULL.

The MULTIKEYHELP structure has the following form:

typedef struct tagMULTIKEYHELP { /* mkh */

DWORD mkSize;

BYTE mkKeylist;

TCHAR szKeyphrase[1];

} MULTIKEYHELP;

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The WinHelp function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

The application must call WinHelp with fuCommand set to HELP_QUIT before closing the window that requested the help. The Help application will not actually terminate until all applications that have requested help have called WinHelp with fuCommand set to HELP_QUIT.