各种钩子类型对应的值

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

各种钩子类型对应的值

Hooks WH_MOUSE_LL and WH_KEYBOARD_LL are system wide, but WH_MOUSE and WH_KEYBOARD are application wide. You need just to replace first ones with another everywhere apropriatly. Constant declarations are:

public const int WH_MOUSE_LL = 14; //global mouse hook constant

public const int WH_KEYBOARD_LL = 13; //global keyboard hook constant

public const int WH_MOUSE = 7; //mouse hook constant

public const int WH_KEYBOARD = 2; //keyboard hook constant

I remember something like that was already discussed here, so if you need more info you can alo dig there. Let me know if it works !

/*

* SetWindowsHook() codes

*/

#define WH_MIN (-1)

#define WH_MSGFILTER (-1)

#define WH_JOURNALRECORD 0

#define WH_JOURNALPLAYBACK 1

#define WH_KEYBOARD 2

#define WH_GETMESSAGE 3

#define WH_CALLWNDPROC 4

#define WH_CBT 5

#define WH_SYSMSGFILTER 6

#define WH_MOUSE 7

#if defined(_WIN32_WINDOWS)

#define WH_HARDWARE 8

#endif

#define WH_DEBUG 9

#define WH_SHELL 10

#define WH_FOREGROUNDIDLE 11

#if(WINVER >= 0x0400)

#define WH_CALLWNDPROCRET 12

#endif /* WINVER >= 0x0400 */

#if (_WIN32_WINNT >= 0x0400)

#define WH_KEYBOARD_LL 13

#define WH_MOUSE_LL 14

#endif // (_WIN32_WINNT >= 0x0400)

#if(WINVER >= 0x0400)

#if (_WIN32_WINNT >= 0x0400)

#define WH_MAX 14

#else

#define WH_MAX 12

#endif // (_WIN32_WINNT >= 0x0400) #else

#define WH_MAX 11

#endif

#define WH_MINHOOK WH_MIN

#define WH_MAXHOOK WH_MAX

#define WM_KEYFIRST 0x0100

#define WM_KEYDOWN 0x0100

#define WM_KEYUP 0x0101

#define WM_CHAR 0x0102

#define WM_DEADCHAR 0x0103

#define WM_SYSKEYDOWN 0x0104

#define WM_SYSKEYUP 0x0105

#define WM_SYSCHAR 0x0106

#define WM_SYSDEADCHAR 0x0107

#if(_WIN32_WINNT >= 0x0501)

#define WM_UNICHAR 0x0109

#define WM_KEYLAST 0x0109

#define UNICODE_NOCHAR 0xFFFF SetWindowsHookEx Function

The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.

Syntax

HHOOK SetWindowsHookEx(

int idHook,

HOOKPROC lpfn,

HINSTANCE hMod,

DWORD dwThreadId

);

Parameters

idHook

[in] Specifies the type of hook procedure to be installed. This parameter can be

one of the following values.

WH_CALLWNDPROC

Installs a hook procedure that monitors messages before the system sends them

to the destination window procedure. For more information, see the

CallWndProc hook procedure.

WH_CALLWNDPROCRET

Installs a hook procedure that monitors messages after they have been processed

by the destination window procedure. For more information, see the

CallWndRetProc hook procedure.

WH_CBT

Installs a hook procedure that receives notifications useful to a computer-based

training (CBT) application. For more information, see the CBTProc hook

procedure.

WH_DEBUG

Installs a hook procedure useful for debugging other hook procedures. For more

information, see the DebugProc hook procedure.

WH_FOREGROUNDIDLE

Installs a hook procedure that will be called when the application's foreground

thread is about to become idle. This hook is useful for performing low priority

tasks during idle time. For more information, see the ForegroundIdleProc hook

相关文档
最新文档