Language :

Fun with GetAsyncKeyState() and the Emulator

This is something that made me waste enough time that I can spend a few more minutes to write about it.

I have been trapping key usage with the GetAsyncKeyState() method. Quite handy. But somehow, I have been unable to catch the “action” button of the D-Pad within the emulator. Just an annoyance, as I can map another key, and it works fine on my two devices ( Dell Axim and HTC Diamond ). But what if another device shows the same issues ?

So I looked around… I tried many things, such as GAPI ( GXOpenInput() ) as I thought maybe the key was being trapped. I tried to setup some hotkeys, … nothing would do. The sample I had started coding from did not implement the basic WM_KEYDOWN handling routine. Of course, as it was replaced by GetAsyncKeyState(). I made sure to trap this message, and miracle, I was able to catch this button.

Now, I am unsure how nice it is to have 2 separate bits of codes doing basically the same thing. Also, I guess I will need to make sure some actions are not done twice. But this is the only way I could trap the middle D-Pad button on the emulator. All else has failed.

Comments are closed.