Search code examples
windows-mobilecompact-framework

Compact Framework - Mapping Keyboard key to button click event


I am working on a wizard for a compact framework application. The wizard has a next and previous button at the bottom left and bottom right of the screen. How would I go about binding a keypad buttons to fire the next and previous buttons. The device that will be running the application has keypad buttons the sit directly below the next and previous buttons and I want to intercept the key events from these buttons and trigger the next and previous button click in my app.


Solution

  • You don't mention if it's a custom Windows CE device or a more "standard" Windows Mobile device.

    • For a Windows CE device, the key can likely be intercepted with combinations of the form's KeyPreview property, the form's KeyDown event, the HardwareButtons from Microsoft.WindowsCE.Forms and the native AllKeys function.
    • For a Windows Mobile device, I'm pretty sure you need to install a keyboard hook to catch the two buttons below the screen...