Please help with keyboard input problem....
hi,
i am working on a small rpg game ubt i seem to be having trouble reading keyboard input in Visual C++
I have it reading the VK_NUMPAD inputs, but when i try to get anything from the rest of the keys, ie VK_A, it says that it is an undeclared identifier..
could someone please tell me what i am doing wrong and why the numpad keys work, but not the normal keys?
thanks for any help on this
Here are the hex ranges of the virtual key codes.
0x30 - 0x39 = Keys 0-9
0x41 - 0x5A = Keys A-Z
Example (Under your WindowProc):
hWnd being the handle to the window.
I Hope this helps you with your problem.
[edited by - Shadow Wolf on October 12, 2002 6:42:27 PM]
0x30 - 0x39 = Keys 0-9
0x41 - 0x5A = Keys A-Z
Example (Under your WindowProc):
hWnd being the handle to the window.
case WM_KEYDOWN:{ switch (wParam) { case 0x41: MessageBox(hWnd, "You hit A", "WM_KEYDOWN", MB_OK); break; case 0x30: MessageBox(hWnd, "You hit 0", "WM_KEYDOWN", MB_OK); break; }//switch return 0;}//WM_KEYDOWN
I Hope this helps you with your problem.
[edited by - Shadow Wolf on October 12, 2002 6:42:27 PM]
October 12, 2002 05:48 PM
GetAsyncKeyState(VK_NUMPADWHATEVER)
GetAsyncKeyState(''A'')
GetAsyncKeyState(''B'')
etc.
GetAsyncKeyState(''A'')
GetAsyncKeyState(''B'')
etc.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement