This topic is now archived and is closed to further replies.

Pocket PC GetAsyncKeyState C#.Net

This topic is 5246 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi.. I''ve been learning for use on a Pocket PC 2002...(uses .net compact framework) On This Site he talks about using GetAsyncKeyState for detecting arrowkeys... Its declared as:
private static extern int GetAsyncKeyState(int vkey);
But Im not able to get it to detect if any of the hardware arrowkeys are down, I believe that Left is 37, Up is 38, Right is 39, and Down is 40...because thats what his enum had.
//in a loop
if (GetAsyncKeyState(38) != 0)
   //This is not reached when i press up...why!?
This is what Im apparently supposed to do, but it doesnt work...argh Can anyone help with this? Thanks, Lord Hen

Share this post

Link to post
Share on other sites
Could it be that Im using the VS.NET 2003 Pocket PC Emulator?

I wont be getting my pocket pc for a few days(shipping...argh) I cant exactly test it on a real device.

If anyone would try this out on both the emulator and the actual device, it would be greatly appreciated =)

psuedocode of what im doing:

if (GetAsyncKeyState(left) == Pressed)
//notify of keypress: msgbox, label, etc
//end loop

Lord Hen

Edit: OK, I got my pocket pc and getasynckeystate DOESNT work on the emulator, but it works like a charm on the actual device. Im sorry, I should have waited until I actually got it.

[edited by - Lord Hen on August 6, 2003 12:20:15 AM]

Share this post

Link to post
Share on other sites