If I want to test if the space key is beeing pressed, I use the GetAsyncKeyState() function like this:
if (GetAsyncKeyState((int) VK_SPACE))
//do something
what do I have to change VK_SPACE to if I want to check if a letter is held down?
ie.
GetAsyncKeyState(VK_B)
//this wont work
thanks
Lalle
You use the value of a the uppercase character
eg
GetAsyncKeyState(''A'') // VK_A
GetAsyncKeyState(''B'') // VK_B
GetAsyncKeyState(''C'') // VK_C
...
with number keys its the same
GetAsyncKeyState(''1'') // VK_1
GetAsyncKeyState(''2'') // VK_2
GetAsyncKeyState(''3'') // VK_3
...
but its different with the num pad keys - I don''t remember
VK_NUM1 i think
eg
GetAsyncKeyState(''A'') // VK_A
GetAsyncKeyState(''B'') // VK_B
GetAsyncKeyState(''C'') // VK_C
...
with number keys its the same
GetAsyncKeyState(''1'') // VK_1
GetAsyncKeyState(''2'') // VK_2
GetAsyncKeyState(''3'') // VK_3
...
but its different with the num pad keys - I don''t remember
VK_NUM1 i think
About the number pad keys, I''m pretty sure Windows treats them the same as the normal number keys when num lock is on, and the arrows keys when it is off.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement