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 11:13:14
-
2012-12-05 14:32:53
-
2012-12-05 11:12:01
-
2012-12-05 13:33:42
-
2012-12-05 11:07:55
-
2012-12-05 14:27:39
-
2010-06-01 23:29:28
-
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-04 13:54:12
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
-
10求HI3519DV500_SDK_V2.0.1.1
-
5有偿求HI3516DV500 + OV5647驱动
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明