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

Started by
3 comments, last by VincentGreen 16 years, 8 months ago
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.
Advertisement
Did you try processing the WM_KEYDOWN message?
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;
}
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.
I learned it from the nehe tutorials as said,

this nehe tutorial handles keyboard input:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=07

This topic is closed to new replies.

Advertisement