This example calls a message filter hook and passes a WM_CLOSE message in message box mode.

#define INCL_WINHOOKS           /* Window Hook Functions        */
#include <os2.h>

BOOL  fHookRet;         /* filter hook return indicator         */
HAB   hab;              /* Anchor-block handle                  */
QMSG  pqmsg;            /* Message to be passed to the
                           message-filter hook                  */
ULONG  ulFilter;        /* Filter                               */
POINTL ptrPos = {5L,5L};/* pointer position                     */

/* initialize message structure */
pqmsg.hwnd  = HWND_DESKTOP;
pqmsg.msg   = WM_CLOSE;
pqmsg.mp1   = MPVOID;
pqmsg.mp2   = MPVOID;
pqmsg.time  = 0L;
pqmsg.ptl   = ptrPos;

/* call hook in message box mode */
ulFilter = MSGF_MESSAGEBOX;

fHookRet = WinCallMsgFilter(hab, &pqmsg, ulFilter);


[Back] [Next]