WinCreateHelpInstance: Difference between revisions
Appearance
Created page with "This function creates an instance of the Help Manager with which to request Help Manager functions. ==Syntax== WinCreateHelpInstance(hab, phinitHMInitStructure) ==Paramete..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function creates an instance of the Help Manager with which to request Help Manager functions. | This function creates an instance of the Help Manager with which to request Help Manager functions. | ||
==Syntax== | ==Syntax== | ||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; hab (HAB) - input | ;hab (HAB) - input:Anchor-block handle. | ||
:Anchor-block handle. | :The handle of the application anchor block returned from the WinInitialize function. | ||
:The handle of the application anchor block returned from the WinInitialize function. | ;phinitHMInitStructure (PHELPINIT) - in/out:Help Manager initialization structure. | ||
;phinitHMInitStructure (PHELPINIT) - in/out | |||
:Help Manager initialization structure. | |||
==Returns== | ==Returns== | ||
;hwndhelp (HWND) - returns | ;hwndhelp (HWND) - returns:Help Manager handle. | ||
:Help Manager handle. | ::NULLHANDLE - Error occurred | ||
::Other - Help Manager handle. | |||
==Remarks== | |||
If an error occurs, it is in the parameter of the HELPINIT structure. | |||
==Example Code== | ==Example Code== | ||
This example shows a typical main function for an application which uses help. Following creation of the main application window the Help Manager is initialized and associated with the window. The help table is defined in the application's resources. When the window is destroyed, terminating the application, the help instance is also destroyed. | This example shows a typical main function for an application which uses help. Following creation of the main application window the Help Manager is initialized and associated with the window. The help table is defined in the application's resources. When the window is destroyed, terminating the application, the help instance is also destroyed. | ||
<pre> | <pre> | ||
#define INCL=_WIN | #define INCL=_WIN | ||
Line 90: | Line 84: | ||
WinTerminate( hab ); | WinTerminate( hab ); | ||
} | } | ||
</pre> | </pre> | ||
Line 109: | Line 91: | ||
* WinDestroyHelpInstance | * WinDestroyHelpInstance | ||
* WinLoadHelpTable | * WinLoadHelpTable | ||
* WinQueryHelpInstance | * WinQueryHelpInstance | ||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 09:58, 5 April 2025
This function creates an instance of the Help Manager with which to request Help Manager functions.
Syntax
WinCreateHelpInstance(hab, phinitHMInitStructure)
Parameters
- hab (HAB) - input
- Anchor-block handle.
- The handle of the application anchor block returned from the WinInitialize function.
- phinitHMInitStructure (PHELPINIT) - in/out
- Help Manager initialization structure.
Returns
- hwndhelp (HWND) - returns
- Help Manager handle.
- NULLHANDLE - Error occurred
- Other - Help Manager handle.
Remarks
If an error occurs, it is in the parameter of the HELPINIT structure.
Example Code
This example shows a typical main function for an application which uses help. Following creation of the main application window the Help Manager is initialized and associated with the window. The help table is defined in the application's resources. When the window is destroyed, terminating the application, the help instance is also destroyed.
#define INCL=_WIN #include <os2.h> #define IDHT_APPLICATION 100 /* id of HELP TABLE in resource file */ main( int argc, char *argv[], char *envp[] ) { HAB hab = WinInitialize( 0 ); HMQ hmq = WinCreateMsgQueue( hab, 0 ); HWND hwnd; HWND hwndClient; HWND hwndHelp; QMSG qmsg; ULONG flStyle; HELPINIT helpinit; /* Setup the help initialization structure */ helpinit.cb = sizeof( HELPINIT ); helpinit.ulReturnCode = 0L; helpinit.pszTutorialName = (PSZ)NULL; /* Help table in application resource */ helpinit.phtHelpTable = (PHELPTABLE)MAKEULONG( IDHT_APPLICATION, 0xffff ); helpinit.hmodHelpTableModule = NULLHANDLE; /* Default action bar and accelerators */ helpinit.hmodAccelActionBarModule = NULLHANDLE; helpinit.idAccelTable = 0; helpinit.idActionBar = 0; helpinit.pszHelpWindowTitle = "APPNAME HELP"; helpinit.fShowPanelId = CMIC_SHOW_PANEL_ID; helpinit.pszHelpLibraryName = "APPNAME.HLP"; /* Register the class */ if( WinRegisterClass( ... ) ) { /* create the main window */ flStyle = FCF_STANDARD; hwnd = WinCreateStdWindow( ... ); if( hwnd ) { /* Create and associate the help instance */ hwndHelp = WinCreateHelpInstance( hab, &helpinit ); if( hwndHelp && WinAssociateHelpInstance( hwndHelp, hwnd ) ) { /* Process messages */ while( WinGetMsg( hab, &qmsg, NULLHANDLE, 0, 0 ) ) { WinDispatchMsg( hab, &qmsg ); } /* endwhile */ } /* Remove help instance - note: add */ /* WinAssociateHelpInstance( NULLHANDLE, hwnd ); */ /* to WM_DESTROY processing to remove the association. */ WinDestroyHelpInstance( hwndHelp ); } } /* finish the cleanup and exit */ WinDestroyMsgQueue( hmq ); WinTerminate( hab ); }
Related Functions
- WinAssociateHelpInstance
- WinCreateHelpTable
- WinDestroyHelpInstance
- WinLoadHelpTable
- WinQueryHelpInstance