Sign in to follow this  

[C++, Win32]Get Pressed Key- How?

This topic is 3779 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

Please post your favorite code for getting the value of the pressed key in a Win32 app. Like when you press 'A' it returns 'A' etc... (GetAsyncKeyState() only checks one key...). I *really* need it. Thanks a lot.

Share this post


Link to post
Share on other sites
I usually use the code from the nehe tutorials. = nehe.gamedev.net

The pressed keys are checked in the WINAPI WinMain:
if (keys['A'])
{
// do sth.
}
and the and the keys which are pressed are set in the callback function, at the message routine:

case WM_KEYDOWN
{
keys[wParam] = TRUE;
}

Share this post


Link to post
Share on other sites
Exactly! I've heard of it but I really don't know how to process it... I need a code, so then I can learn from it- but first I need CODE! I tried many times to create it and failed...
Please post some code- thanks.

Share this post


Link to post
Share on other sites

This topic is 3779 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.

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