Reassigning the soft keys

H

Hugh Janus

Hi all,

I am using VB2005 to write a program for Windows Mobile 5.

I have removed the control mainmenu from my form and I now need to
capture the keypress for when a user presses the left soft key (which
says "Start" on the main Windows screen) and the right soft key (which
says "Contacts" on the main windows screen).

Does anyone know how to do this? I have managed to capture the
pressing of the back key with this code, but I cannot work out the
code for the 2 soft keys:

If e.KeyChar = ChrW(Keys.Escape) Then

Debug.WriteLine("back")
e.Handled = True

End If


Thanks in advance
 
H

Hugh Janus

Hi all,

I am using VB2005 to write a program for Windows Mobile 5.

I have removed the control mainmenu from my form and I now need to
capture the keypress for when a user presses the left soft key (which
says "Start" on the main Windows screen) and the right soft key (which
says "Contacts" on the main windows screen).

Does anyone know how to do this?  I have managed to capture the
pressing of the back key with this code, but I cannot work out the
code for the 2 soft keys:

If e.KeyChar = ChrW(Keys.Escape) Then

    Debug.WriteLine("back")
    e.Handled = True

End If

Thanks in advance


Sigh, I found the answer and it really is utter stupidity by MS for
doing this.

I found a page on MSDN that told me that the left key is F1 and the
right one is F2. However, when I placed the code on my form I could
not get it to work. The reason is simple, I had used the KeyPress
event rather than the KeyDown event. When I switched to the KeyDown
event the code worked and detected an F1 button being pressed.

Totally undocumented and inconsistent with the KeyPress event.

So I am posting the answer here to stop other people losing over a day
of their life on something as stupid as this.

Hugh
 

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