在mobile下怎么截取pocket Pc硬件按钮的按键消息

在mobile下如何截取pocket Pc硬件按钮的按键消息?
在默认的情况下,按下PPC的硬件按键会启动其它的应用程序(如:联系人、日历等)。我想在我的应用程序中处理PPC的硬件按键事件,应该如何做呢?


------解决方案--------------------
获得虚拟键值,
可以通过WM_KEYDOWN 消息来获得,
如下说明:
WM_KEYDOWN nVirtKey = (int) wParam;
lKeyData = lParam;


通过RegisterHotKey注册热键,
通过这个WM_HOTKEY消息来截取对应虚拟键消息并做相应处理
------解决方案--------------------
你在网上查查相关的键盘钩子的资料.这个应该能完成你要的功能.这是我以前做的项目用到的,你先看一下
#include "stdafx.h"
#include "winceKBhook.h"

//globals
HINSTANCE g_hHookApiDLL = NULL; //handle to coredll.dll, where all the hook related APIs are present
HHOOK g_hInstalledLLKBDhook = NULL; //g_hInstalledLLKBDhook represents handle to the installed KB hook
HINSTANCE hInst=NULL; //引用实例的名柄

BOOL TimeInterval(LPSYSTEMTIME OldTime,LPSYSTEMTIME NowTime,int Interval);
/** 
* Function Name:ActivateKBHook
*
* Function Desc:Initializes the proc. adress of various hook related APIs.
* Loads the keyboard hook.
*
* Parameters:
* HINSTANCE hInstance : handle to the application to be hooked
* HOOKPROC LLKeyboardHookCallbackFunction : procedure where the control will come to after any KB event.
* Returns:
* true if we get all the proc addresses of hook related APIs and load the hook succesfully
* false if any of the above fails
*
* Author: Prathamesh Kulkarni
**/
BOOL ActivateKBHook(HINSTANCE hInstance)
{
//we need to manually load these standard Win32 API calls
//MSDN states that these aren't supported in WinCE
SetWindowsHookEx = NULL;
CallNextHookEx = NULL;
UnhookWindowsHookEx = NULL;
hInst=hInstance;
//now load the coredll.dll
g_hHookApiDLL = LoadLibrary(_T("coredll.dll"));




if(g_hHookApiDLL == NULL) 
{
//something is awfully wrong
//the dll has to be present
return false;
}
else
{
//load the SetWindowsHookEx API call
//the SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. 
//You would install a hook procedure to monitor the system for certain types of events.
//here we use use the hook to monitor kyeboard events
SetWindowsHookEx = (_SetWindowsHookExW)GetProcAddress(g_hHookApiDLL, _T("SetWindowsHookExW"));
if(SetWindowsHookEx == NULL)
{
//this means that MS has really stopped supporting this API in WinCE
return false;
}
else
{
//install the KB hook
//the hande needs to be saved for default processing of the events and to uninstall the hook, once we are done with it
g_hInstalledLLKBDhook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc, hInstance, 0);
if(g_hInstalledLLKBDhook == NULL)
{
return false;
}

}

//load CallNextHookEx() API call
//the CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. 
//we use this call for default processing of events.
CallNextHookEx = (_CallNextHookEx)GetProcAddress(g_hHookApiDLL, _T("CallNextHookEx"));
if(CallNextHookEx == NULL)
{
return false;
}

//load UnhookWindowsHookEx() API
//the UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
//we use this call to unistall the hook.
UnhookWindowsHookEx = (_UnhookWindowsHookEx)GetProcAddress(g_hHookApiDLL, _T("UnhookWindowsHookEx"));
if(UnhookWindowsHookEx == NULL) 
{
return false;
}
}

//all the APIs are loaded and the application is hooked
return true;
}