Windows CE下的键盘钩子
在coredll.dll中有SetWindowsHookEX相关函数,这里用LoadLibrary和GetProcAddress可以调用。 以下是测试代码: //Install the KB hook by passing the //handle of the application to be hooked //and the address of the KB procedure //which will handle all the KB events if(!ActivateKBHook(hInstance, LLKeyboardHookCallbackFunction)) { MessageBox(GetActiveWindow(), TEXT("Couldn't intall hook...Terminating"), TEXT("Warning"), NULL); exit(1); }
//LLKeyboardHookCallbackFunction is the funtion whose //address we passed to the system while installing the hook. //so all the KB events will bring the control to this procedure. //Here we want that when the user presse left or //right key it should be interpreted as an UP key //so now you can allow the user to configure the //key boards the way he/she wants it LRESULT CALLBACK LLKeyboardHookCallbackFunction( int nCode, WPARAM wParam, LPARAM lParam) { if(((((KBDLLHOOKSTRUCT)lParam)->vkCode) == VK_LEFT) || ((((KBDLLHOOKSTRUCT)lParam)->vkCode) == VK_RIGHT)) { //Generate the keyboard press event of the mapped key keybd_event(VK_UP, 0, 0, 0);
//release the mapped key
keybd_event(VK_UP, 0, KEYEVENTF_KEYUP, 0);
}
//let default processing take place
return CallNextHookEx(g_hInstalledLLKBDhook, nCode,
wParam, lParam);
}
//we are done with the hook. now uninstall it. DeactivateKBHook(); Windows CE下的键盘钩子程序的应用这里有个例程...
本帖最后由 crystal 于 2008-8-18 22:22 编辑
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
-
2008-05-27 11:09:53
-
2008-07-18 20:42:04
-
2010-06-01 23:25:04
-
2008-07-24 01:33:17
-
2012-12-05 14:39:10
-
2012-12-05 14:32:53
-
2012-12-05 11:13:14
-
2012-12-05 11:12:01
-
2012-12-05 14:27:39
-
2010-06-01 23:29:28
-
2012-12-05 11:07:55
-
2012-12-05 13:33:42
-
2008-11-02 17:14:58
-
2012-12-05 13:34:26
-
2012-12-05 13:38:25
-
2012-12-04 14:09:01
-
2012-12-04 13:36:34
-
2012-12-04 14:17:38
-
2012-12-05 14:19:35
-
10海思IVP928
-
522AP10支持F35SQA001G spi nand flash
-
20如何将自有训练的RAW降噪模型应用于AIBNR?
-
10RV1106的低功耗和休眠唤醒功能
-
10海思平台(Hi3516DV500),设置完ldc参数后 工作异常
-
5rv1126-dc-201 安装hi3881.ko wifi驱动成功后 启动connmand服务,系统就崩了
-
10ss928编码的h264帧流,用RTSP传输到电脑,VLC播放不了是什么情况?
-
10我运行rv1126的开发环境后,编译demo提示没有opencv,自行编译安装后没有解决,请问这个怎么处理呢?板子是easy eai nano
-
50CPS-1848 link不上FPGA。
-
10想问一下各位大佬们,关于VI配置成8Lan LVDS模式的相关问题
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明