WinQueryHelpInstance
Appearance
This function enables the application to query the instance of the Help Manager associated with the application-supplied window handle.
Syntax
WinQueryHelpInstance(hwndApp)
Parameters
- hwndApp (HWND) - input
- Handle of the application window.
Returns
- hwndHelp (HWND) - returns
- Help Manager window handle.
- NULLHANDLE
- No Help Manager instance is associated with the application window.
- Other
- Help Manager window handle.
Remarks
The Help Manager first traces the parent window chain until it is NULLHANDLE or HWND_DESKTOP. Then Help Manager traces the owner chain. If a parent of the owner window exists, the trace begins again with the parent chain.
The window chain will be traced until the Help Manager finds an instance of the Help Manager or until both the parent and owner windows are NULLHANDLE or HWND_DESKTOP.
Example Code
This example shows the use of the WinQueryHelpInstance call during the processing of a WM_INITMENU message in order to obtain the handle for sending an HM_SET_ACTIVE_WINDOW message.
#define INCL_WIN #include <os2.h> MRESULT wm_initmenu( HWND hWnd, ULONG ulMsg, MPARAM mp1, MPARAM mp2 ) { /* Send message to establish the current window's parent */ /* as the active help window. */ WinSendMsg( WinQueryHelpInstance( hWnd ), HM_SET_ACTIVE_WINDOW, (MPARAM)WinQueryWindow( hWnd, QW_PARENT ), (MPARAM)WinQueryWindow( hWnd, QW_PARENT ) ); /* Pass message on for default processing */ return WinDefWindowProc( hWnd, ulMsg, mp1, mp2 ); }
Definition
#define INCL_WINHELP /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndApp; /* Handle of the application window. */ HWND hwndHelp; /* Help Manager window handle. */ hwndHelp = WinQueryHelpInstance(hwndApp);