Sign in to follow this  
gael

Window keys

Recommended Posts

gael    122
Hello, I'm starting Windows programming and I'm searching how I can simply retrieve the current key pressed... Thanks for your answer!

Share this post


Link to post
Share on other sites
prh99    520
You can also use GetAsyncKeyState from the Windows API. You can find the details on it's use at MSDN. I suspect undeads method is the easier of the two if you're using C.

Share this post


Link to post
Share on other sites
gael    122
OK, it works. I use the message loop and I copy wParam to a variable if
key down or I set it to -1 if key is up. My GetKey() function simply returns the variable.

Thanks a lot!

Is there a way to do it without using the message loop, like with
GetAsyncKeyState() for example?

n.b. I use C++

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this