Hardware button not in registry

K

Kath

I am using an XDA 2 (PPC phone). It has 7 buttons in total - calendar,
contacts, record, camera, "toggle", and two phone buttons. In the
registry (HKLM/Software/Microsoft/Shell/Keys) it lists only the first
four buttons. Is it still possible to access the toggle button using
RegisterHotKey? I'm using VB.NET and found some code to handle
hardware keys (http://groups.google.com/[email protected]&rnum=5),
although I'm still trying to get it to work.

I need to program the button to open my app when the toggle button is
pressed.

Thanks!
Kath
 
C

Chris Tacke, eMVP

It probably acts like an "Enter" keyboard key, so treat it that way.

-Chris
 
K

Katherine Hawkes

Thanks Chris.

I tried using the OnKeyPress event, which works when the application has
focus, but it doesn't work when it doesn't have focus. I need the toggle
button to work when the user has used the phone and needs to return to
my app (i.e. a method that is OS wide, not just application specific).
The RegisterHotKey method seems to do this, but I can't find how to use
it for the toggle key.

Kath
 
K

Kath

It seems it is not possible to use RegisterHotKey with the toggle
button (unfortunately!). I had to get round it by using the other
buttons on the PDA. I was trying to use them to close the Phone form,
to allow users to get back to my app (they cannot use the minimise
button because I have disabled the toolbar to prevent users accessing
other programs - it seems you cannot disable the StartMenu on its
own). I used the RegisterHotKey functions (see
http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=283) and added the
following code for a button press:

IntPtr hWnd;
hWnd = FindWindow(null, "Phone");
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE +
SWP_HIDEWINDOW);

Using SetWindowPos was the only way I could find to close the Phone
form - it doesn't seem to respond to the WM_CLOSE message. Calling
DestroyWindow premanently destroys the form, you have to soft reset to
open the phone again.

Hope this info helps someone else!

Thanks,
Kath
 

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

Top