64,650
社区成员
发帖
与我相关
我的任务
分享
SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,GetModuleHandle("dllhook"),0);
LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam)
{
//如按键盘1“已知窗口句柄”应该会收到HOOK到的消息1阿?
::SendMessage(已知窗口句柄,code,wParam,lParam);
//为什么这样发送消息 SendMessage已经返回0 表明成功发送 但我的 窗口没有收到消息?
return 1;
}
LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam)
{
//首先,你应过虑你要捕获的按键(wParam是虚拟键码)
::SendMessage(已知窗口句柄,code,wParam,lParam);
//为什么这样发送消息 SendMessage已经返回0 表明成功发送 但我的 窗口没有收到消息?
return 1;
}
MSDN
//wParam
//[in] Specifies the virtual-key code of the key that generated the keystroke message.
//lParam
//[in] Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag. This parameter can be one or more of the following values.