Trap red/green phone button..

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone, this is my problem:
I need to trap RED and GREEN phone button press and in C# i have solved whit
this:

public enum KeyModifiers : int
{
None = 0,
Alt = 1,
Control = 2,
Shift = 4,
Windows = 8,
ModKeyUp = 0x1000
}

public enum KeysHardware : int
{
RedPhoneButton = 0x73,
GreenPhoneButton = 0x72
}

[DllImport("coredll.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id,
KeyModifier modifiers, int key);


RegisterHotKey(hWnd, KeysHardware.RedPhoneButton, KeyModifiers.None,
KeysHardware.RedPhoneButton);

...

In C# i trap key press on my form with a MessageWindows event and this work
fine, but in C++ this don't work...

RegisterHotKey(hWnd, 115, 0, 115);
i put 0 in UINT fsModifiers parameter but don't work...i have further tested
whit
MOD_WIN, MOD_KEYUP, MOD_CONTROL....but don't work...

Can help me?
Thanks in advance..

--Ste
 
You should use KeyModifiers.None for the phone keys. Also note that you
can't use this method to trap the phone keys on Smartphone, only on Pocket
PC Phone Edition.

Peter
 
In C++, i have used

RegisterHotKey(hWnd, 115, 0, 115);

i don't have MOD_NONE.......so i have used 0....but don't work.


Peter Foot said:
You should use KeyModifiers.None for the phone keys. Also note that you
can't use this method to trap the phone keys on Smartphone, only on Pocket
PC Phone Edition.

Peter

--
Peter Foot
Windows Embedded MVP
www.peterfoot.net | www.inthehand.com

Azzi Stefano said:
Hi everyone, this is my problem:
I need to trap RED and GREEN phone button press and in C# i have solved
whit
this:

public enum KeyModifiers : int
{
None = 0,
Alt = 1,
Control = 2,
Shift = 4,
Windows = 8,
ModKeyUp = 0x1000
}

public enum KeysHardware : int
{
RedPhoneButton = 0x73,
GreenPhoneButton = 0x72
}

[DllImport("coredll.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id,
KeyModifier modifiers, int key);


RegisterHotKey(hWnd, KeysHardware.RedPhoneButton, KeyModifiers.None,
KeysHardware.RedPhoneButton);

...

In C# i trap key press on my form with a MessageWindows event and this
work
fine, but in C++ this don't work...

RegisterHotKey(hWnd, 115, 0, 115);
i put 0 in UINT fsModifiers parameter but don't work...i have further
tested
whit
MOD_WIN, MOD_KEYUP, MOD_CONTROL....but don't work...

Can help me?
Thanks in advance..

--Ste
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top