Keyboard Hooking in Windows CE 6.0
来源:互联网 发布:网络教育上市公司 编辑:程序博客网 时间:2024/06/05 17:00
If you want to monitor system wide keyboard events from an application, then we need to use keyboard hooking using the SetWindowsHookEx & UnhookWindowsHookEx functions. Since we need a system wide hook, we need to place the callback functions in a DLL.
But in Wince 6.0, these APIs have been removed, but is still present in coredll. Hence, they can be accessed using LoadLibrary and GetProcAddress functions.
N.B: Special Thanks Prathamesh S Kulkarni on his article on keyboard hooking in code project.
typedef struct {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
.....
VOID InitHook ()
{
.....
SetWindowsHookEx(WH_KEYBOARD_LL,hookproc,hinstance,NULL);
.....
}
....
HOOKDLL_API LRESULT CALLBACK hookproc(int ncode,WPARAM wparam,LPARAM lparam)
{
UINT uMsg = 0;
if(ncode>=0)
{
if((lparam & 0x80000000) == 0x00000000)//Check whether key was pressed(not released).
{
switch((((KBDLLHOOKSTRUCT*)lparam)->vkCode))
{
case VK_F1:
RETAILMSG(1,(TEXT("TRAPPED, F1/r/n")));
uMsg = WM_USER+755;
break;
case VK_F2:
RETAILMSG(1,(TEXT("TRAPPED, F2/r/n")));
uMsg = WM_USER+756;
break;
case VK_F3:
RETAILMSG(1,(TEXT("TRAPPED, F3/r/n")));
uMsg = WM_USER+757;
break;
case VK_F4:
RETAILMSG(1,(TEXT("TRAPPED, F4/r/n")));
uMsg = WM_USER+758;
break;
}
}
}
return ( CallNextHookEx(hook,ncode,wparam,lparam) );//pass control to next hook in the hook chain.
}
But in Wince 6.0, these APIs have been removed, but is still present in coredll. Hence, they can be accessed using LoadLibrary and GetProcAddress functions.
N.B: Special Thanks Prathamesh S Kulkarni on his article on keyboard hooking in code project.
- Keyboard Hooking in Windows CE 6.0
- SHChangeNotifyRegister in Windows CE
- Interruption Management in Windows CE
- Memory marshalling in Windows CE
- [DOC]Hooking Windows api
- Using Keyboard Interface Control in Windows
- Windows CE 6.0
- The USB Webcam driver in Windows CE
- printscreen in Windows/CE/Mobile
- windows ce 6.0之Hello CE
- Understanding Memory Sections in config.bib, boot.bib, and OEMAddressTable in Windows CE 5.0 and 6.0
- Understanding Memory Sections in config.bib, boot.bib, and OEMAddressTable in Windows CE 5.0 and 6.0
- Understanding Memory Sections in config.bib, boot.bib, and OEMAddressTable in Windows CE 5.0 and 6.0
- Hooking Windows NT System Services
- Modifications: Windows CE 5.0 vs. Windows Embedded CE 6.0
- Windows CE 6.0 安装顺序
- Windows CE 6.0 安装顺序
- Windows CE 6.0 安装顺序
- 工作思考之测试
- Enabling agressive scanning for Wifi
- [Java] 练习题020
- 回溯法
- Qt配置使用VS2010进行开发
- Keyboard Hooking in Windows CE 6.0
- Remote Tools and CETK over activesync
- linux创建域
- Debugging a booting problem
- Flex动态DataGrid 二
- starUml使用
- 选择
- 如何合理设置Linux的swap分区
- eclipse如何重新编译整个工程?