This example uses the WinSetHook call to intercept user-input messages from the application queue.

#define INCL_WINHOOKS
#include <OS2.H>
void RecordHook(HAB hab, PQMSG pqmsg);  /* prototype of hook */
                                        /* procedure.        */
samp()
{
HAB hab;
WinSetHook(hab,
          HMQ_CURRENT,
          HK_JOURNALRECORD,
          (PFN)RecordHook,
          (HMODULE)0); /* hook is into application queue. */

WinReleaseHook(hab,
              HMQ_CURRENT,
              HK_JOURNALRECORD,
              (PFN)RecordHook,
              (HMODULE)0); /* hook is into application queue, */

}
/*  This hook records user-input messages.  */
void RecordHook(HAB hab, PQMSG pqmsg)
{
   /*  ...   */
}


[Back] [Next]