深入浅出HOOKS(之陆)[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 jaccorporation 的 blog

 

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];

本文关键:hooks
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top