platform sdk: interprocess communications
monitoring system events
the following example uses a variety of thread-specific hook procedures to monitor the system for events affecting a thread. it demonstrates how to process events for the following types of hook procedures:
wh_callwndproc
wh_cbt
wh_debug
wh_getmessage
wh_keyboard
wh_mouse
wh_msgfilter
the user can install and remove a hook procedure by using the menu. when a hook procedure is installed and an event that is monitored by the procedure occurs, the procedure writes information about the event to the client area of the application's main window.
#define numhooks 7
// global variables
typedef struct _myhookdata
{
int ntype;
hookproc hkprc;
hhook hhook;
} myhookdata;
myhookdata myhookdata[numhooks];
lresult winapi mainwndproc(hwnd hwndmain, uint umsg, wparam wparam,
lparam lparam)
{
static bool afhooks[numhooks];