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 11:12:01
-
2012-12-05 14:32:53
-
2012-12-05 14:27:39
-
2012-12-05 13:33:42
-
2010-06-01 23:29:28
-
2012-12-05 11:07:55
-
2008-11-02 17:14:58
-
2012-12-05 13:34:26
-
2012-12-04 14:09:01
-
2012-12-05 13:38:25
-
2012-12-04 14:17:38
-
2012-12-04 13:36:34
-
2012-12-04 13:54:12
-
5SS928的emmc有32GB,bootargs设置使用16GB,但是为啥能用的只有rootfs的大小
-
33SS928怎样烧写ubuntu系统
-
10ToolPlatform下载rootfs提示网络失败
-
10谁有GK7205V500的SDK
-
5Hi3516CV610 烧录不进去
-
10Hi3559AV100 芯片硬解码h265编码格式的视频时出现视频播放错误,解码错误信息 s32PackErr:码流有错
-
5海思SS928 / SD3403的sample_venc.c摄像头编码Demo中,采集到的摄像头的YUV数据在哪个相关的函数中?
-
5海鸥派openEuler无法启动网卡,连接WIFI存在问题
-
66有没有ISP相关的巨佬帮忙看看SS928对接IMX347的图像问题
-
50求助hi3559与FPGA通过SLVS-EC接口对接问题
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明