Wednesday, April 02, 2008

Smartphone keyboard handling with GAPI

Here's the scenario: you are working on a DirectDraw full screen application and you require full control of the device keyboard. Things have worked nicely with the Pocket PC and even with the WM5 Smartphone, but when you move to WM6 your keyboard is gone. You do get the WM_KEYDOWN and WM_KEYUP messages, but most of them only report the dreaded VK_PROCESSKEY and ImmGetVirtualKey() does not seem to help at all. What can you do?

I found a solution for this problem that solves most of the issues above, but also uncovers some other issues. The solution is to call ImmAssociateContext() on your main window passing NULL as the HIMC parameter. This will remove the input context association from the window, and you get the keyboard back. But...

... now you have to handle the keyboard mappings yourself. That's the price you pay. On some devices this means having a mixed keyboard (numbers and alpha keys) so you must internally implement a keyboard map in order to make it work as the user expects. To make matters worse, the keyboard map is device dependent so you are in for a bit of work. Finally, I have found that on some devices you don't get all the keys, especially the special keys for mail and contacts. These devices seem to have these keys wired to launch the matching applications and not even GAPI seems to release them...


wolverxman said...

In fact a lot of Smartphones already have a 320x240 (Portrait) display, so the only difference in the Q is that the screen is oriented Landscape instead of Portrait. It would have been much better and simpler for developers if Motorola had implement GAPI correctly rather than tried to provide some dubious emulation mode for old applications designed only for older 176x220 Smartphones
This is a very interesting blog, i appreciate the information you provided
Earn money through online by Social network websites websites


Spread The Word Out! A New Way To Advertise Online! WideCircles aka Wide Circles is one of a kind social advertising platform that avoids issues related to PPC Fraud!

costofbotoxinjections said...

I need it . if you want to interest .I Recommend website about bluetooth laser virtual keyboard

commentator said...

We have no way to maintain the wireless keyboard.
Until I found the information from this site.
It is very useful for people who use the laptop / palm.

thank you Nice Admin :) said...

I get well soon
I have a Qestion this keyboard .
Is it a Dimension ?