VK_B?

Started by
4 comments, last by Lalle 22 years, 8 months ago
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
Advertisement
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
Like this:

GetAsyncKeyState(''B'');
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.
Thanks alot! :-)

Lalle
you better use it like

if (GetAsyncKeyState(key) & 0x8000) return(key is down);

Arkon
[QSoft Systems]

This topic is closed to new replies.

Advertisement