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 );
}