Before you call WinCreateHelpInstance, you must allocate memory for and initialize the HELPINIT structure. This structure defines values that IPF needs to create the help instance. Some of the values can be changed by your application after initialization.
The HELPINIT structure and the help table structures referred to by IPF during help processing are contained in the PMHELP.H file. The PMHELP.H file also contains the error codes returned in the event of an unsuccessful call. You include this file in your source code by using the INCL_WINHELP define statement. The following shows the HELPINIT structure.
typedef struct _HELPINIT /* hinit */ { ULONG cb; ULONG ulReturnCode; PSZ pszTutorialName; PHELPTABLE phtHelpTable; HMODULE hmodHelpTableModule; HMODULE hmodAccelActionBarModule; ULONG idAccelTable; ULONG idActionBar; PSZ pszHelpWindowTitle; ULONG fShowPanelId; PSZ pszHelpLibraryName; } HELPINIT;
Following are descriptions of the HELPINIT structure fields.
Field Name
If the user selects the Tutorial choice in the pull-down, IPF sends the HM_TUTORIAL message to the application so that it can start the tutorial.
This flag is useful during the development stages of the help interface.
After initialization, this flag can be toggled with the HM_SET_SHOW_PANEL_ID message.
After initialization, help library names can be specified with the HM_SET_HELP_LIBRARY_NAME message. If multiple libraries are specified, library names must be separated by a blank space.
The following example shows a help facility being initialized. Notice that hmodAccelActionBarModule, idAccelTabl e, and idActionBar have values set to 0; this is because this example uses a standard menu bar.
VOID HelpInit (VOID){ HELPINIT hini; /* if we return because of an error, Help will be disabled */ fHelpEnabled = FALSE; /* initialize help init structure */ hini.cb = sizeof (HELPINIT) hini.ulReturnCode = 0L; hini.pszTutorialName = (PSZ)NULL /*if tutorial added, add name here*/ hini.phtHelpTable = (PHELPTABLE)MAKELONG(JIGSAW_HELP_TABLE, 0xFFFF); hini.hmodHelpTableModule = (HMODULE)0; hini.hmodAccelActionBarModule = (HMODULE)0; hini.idAccelTable = 0; hini.idActionBar = 0; if (!WinLoadString (habMain, (HMODULE)0, IDS_HELPWINDOWTITLE, HELPLIBRARYNAMELEN, (PSZ)szWindowTitle)) { MessageBox (habMain, IDS_CANNOTLOADSTRING, MB_OK | MB_ERROR, FALSE); return; } hini.pszHelpWindowTitle = (PSZ)szWindowTitle; /* if debugging, show panel ids; else, don't */ #ifdef DEBUG hini.fShowPanelId = CMIC_SHOW_PANEL_ID; #else hini.fShowPanelId = CMIC_HIDE_PANEL_ID; #endif if (!WinLoadString (habMain, (HMODULE)0, IDS_HELPLIBRARYNAME, HELPLIBRARYNAMELEN, (PSZ)szLibName)) { MessageBox (habMain, IDS_CANNOTLOADSTRING, MB_OK | MB_ERROR, FALSE); return; } hini.pszHelpLibraryName = (PSZ)szLibName;