Can NOT Get the WM_HOTKEY msg

  • Thread starter Thread starter steel
  • Start date Start date
S

steel

Hi, everyone, I am fighting with a project with 5 Hotkey registerd. but

when the VK code is 66 67 68 69 71, the WM_HotKey msg can not fired,
but if changed the VK code to 117 ... 121 , the Project runs well. I
have look up the MSDN, but get no answerns yet.Can anyone make me known

the reason?

I have found that when the Vitual KeyCode is 66-70, the system viewed
it as normal keyEvent, Not HotKey event.
the related code:
public enum KeysHardware : int
{
Hardware1 = 66, //117,//
Hardware2 = 67, //118,//
Hardware3 = 68, //119,//
Hardware4 = 69, //120,//
Hardware5 = 71 // 121 //
}


public static void RegisterRecordKey(IntPtr hWnd)
{
bool Ret;
Ret = UnregisterFunc1(KeyModifiers.None,
(int)KeysHardware.Hardware1);
Ret = RegisterHotKey(hWnd, (int)KeysHardware.Hardware1,
KeyModifiers.None, (int)KeysHardware.Hardware1);


Ret = UnregisterFunc1(KeyModifiers.None,
(int)KeysHardware.Hardware2);
Ret = RegisterHotKey(hWnd, (int)KeysHardware.Hardware2,
KeyModifiers.None, (int)KeysHardware.Hardware2);


Ret = UnregisterFunc1(KeyModifiers.None,
(int)KeysHardware.Hardware3);
Ret = RegisterHotKey(hWnd, (int)KeysHardware.Hardware3,
KeyModifiers.None, (int)KeysHardware.Hardware3);


Ret = UnregisterFunc1(KeyModifiers.None,
(int)KeysHardware.Hardware4);
Ret = RegisterHotKey(hWnd, (int)KeysHardware.Hardware4,
KeyModifiers.None, (int)KeysHardware.Hardware4);
}


any suggestions and solutions will be very appreciated.
 
The hardware keys are usually send with the Windows key modifier. Also check
that your hWnd is valid that you pass to RegisterHotKey. If you are using
..NETCF v2.0 you can use the Microsoft.WindowsCE.Forms.HardwareButton
component.

Peter
 
Dear Peter, Thanks for your reply.
I have checked my hWnd, it IS valid, and RegisterHotKey's retern value
is also right. the same code, another group of Vitual KeyCode(117-121)
can run correctly.
It seems that The HardwareButton is only supported by PPC platform,
and my platform is winCE 5.0.
 
Back
Top