Registerhotkey windows CE


I

Ivo van Halen

I am trying to register a hotkey in a Windows CE .NET 4.2 application. I
want that when the key is pressed the application that registered it gets
the focus and then fire an event.

I have made to following code:

-----------CODE-----------
Public Declare Function RegisterHotKey Lib "CoreDLL.dll" (ByVal hWnd As
IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As
Integer) As Boolean
-----------ENDCODE-----------

And I call this code to register for example the 'b' button with the
following sample:
-----------CODE-----------
Me.Capture = True
Dim hWnd As IntPtr = GetCapture()
Me.Capture = False
TextBox2.Text = hWnd.ToString()
RegisterHotKey(hWnd, CInt(Keys.B), HotKeyModifiers.MOD_None, CInt(Keys.B))
-----------ENDCODE-----------

This doent seem to work the application doesnt get the focus when the button
'B' is pressed on the device. Does anybody know what I am doing wrong or
does anybody know and other solution.
 
Ad

Advertisements

P

Paul G. Tobey [eMVP]

The application isn't automatically activated as a result of a hotkey being
fired. It just gets a WM_HOTKEY event sent to its window procedure. If it
wants to do something as a result, it has to do that in response to that
event. Is the event being fired?

Paul T.
 
Ad

Advertisements

I

Ivo van Halen

Thanks for the Response Paul T. That was just the tip that I needed. I made
a messagewindow to handle the event now, and it works fine now :)



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> schreef in bericht news:[email protected]
 

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