This example uses the WinReleaseHook call to release a hook that records user-input messages from the application queue.
#define INCL_WINHOOKS #include <OS2.H> void RecordHook(HAB hab, PQMSG pqmsg); 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) { /* ... */ }