WinDestroyHelpInstance: Difference between revisions
Appearance
Created page with "This function destroys the specified instance of the Help Manager. ==Syntax== WinDestroyHelpInstance(''hwndHelpInstanc''e) ==Parameters== ;''hwndHelpInstance'' (HWND) - in..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function destroys the specified instance of the Help Manager. | This function destroys the specified instance of the Help Manager. | ||
==Syntax== | ==Syntax== | ||
WinDestroyHelpInstance('' | WinDestroyHelpInstance(''hwndHelpInstance'') | ||
==Parameters== | ==Parameters== | ||
;''hwndHelpInstance'' (HWND) - input | ;''hwndHelpInstance'' (HWND) - input:Handle of the instance of the Help Manager to be destroyed. | ||
:Handle of the instance of the Help Manager to be destroyed. | :This is the handle returned by the [[WinCreateHelpInstance]] call. | ||
:This is the handle returned by the WinCreateHelpInstance call. | |||
==Returns== | ==Returns== | ||
;rc (BOOL) - returns | ;rc (BOOL) - returns:Success indicator. | ||
:Success indicator. | :;TRUE:Successful completion | ||
:;TRUE | :;FALSE:Error occurred. | ||
:;FALSE | |||
==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 | #define INCL_WIN | ||
#include <os2.h> | #include <os2.h> | ||
#define IDHT_APPLICATION | #define IDHT_APPLICATION 100 /* id of HELP TABLE in resource file */ | ||
*/ | |||
main( int argc, char *argv[], char *envp[] ) | main( int argc, char *argv[], char *envp[] ) | ||
Line 83: | Line 79: | ||
WinTerminate( hab ); | WinTerminate( hab ); | ||
} | } | ||
</pre> | </pre> | ||
Latest revision as of 20:39, 27 November 2023
This function destroys the specified instance of the Help Manager.
Syntax
WinDestroyHelpInstance(hwndHelpInstance)
Parameters
- hwndHelpInstance (HWND) - input
- Handle of the instance of the Help Manager to be destroyed.
- This is the handle returned by the WinCreateHelpInstance call.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
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 ); }
Definition
#define INCL_WINHELP /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndHelpInstance; /* Handle of the instance of the Help Manager to be destroyed. */ BOOL rc; /* Success indicator. */ rc = WinDestroyHelpInstance(hwndHelpInstance);