This example uses the WinSetMsgInterest call to set the message interest of a window to only WM_SHOW messages.
#define INCL_WINMESSAGEMGR #define INCL_WINHOOKS #include <OS2.H> HWND hwnd; HAB hab; BOOL fSuccess; /* Hook Procedure Prototype */ BOOL MsgCtlHook(HAB hab,LONG idContext, /* this hook can */ HWND hwnd, PSZ pszClassname, /* be given any */ ULONG ulMsgclass, /* name. */ LONG idControl, PBOOL fSuccess); main() { /* This function passes the hook procedure address to the system. */ WinSetHook(hab, (HMQ)0, MCHK_CLASSMSGINTEREST, (PFN)MsgCtlHook, (HMODULE)0); /* hook is into application queue. */ /* This function sets the message interest of a window class. */ WinSetMsgInterest(hwnd, WM_SHOW, SMI_AUTODISPATCH); /* interested in the */ /* messages, but they are to */ /* be automatically dispatched */ /* to the window procedure. */ } BOOL MsgCtlHook(HAB hab, LONG idContext, /* this hook can */ HWND hwnd, PSZ pszClassname, /* be given any */ ULONG ulMsgclass, /* name. */ LONG idControl, PBOOL fSuccess) { /* ... */ }