有谁做过NT或者Window2k下的Hook
sor 2001-10-23 11:49:07 我想做一个全局键盘Hook,使用SetWindowsHookEx函数
HHOOK SetWindowsHookEx(
int idHook, // hook type
HOOKPROC lpfn, // hook procedure
HINSTANCE hMod, // handle to application instance
DWORD dwThreadId // thread identifier
);
其中的idHook 有一个可选值是WH_KEYBOARD_LL,其说明是
WH_KEYBOARD_LL
Windows NT/2000: Installs a hook procedure that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procedure.
可是我找遍了我的硬盘,都没有找到WH_KEYBOARD_LL 的定义
还有参数dwThreadId 的说明是
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
但当我指定这个参数为0时,程序一运行连VB都关了,即使我指定其值为App.ThreadID,程序运行也很不正常,经常死