Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetAsyncKeyState(0x57) works fine, but not GetAsyncKeyState('w') [closed]

Tags:

c++

So, yeah, 0x41 is 'w', but why is this

GetAsyncKeyState(0x57)

working and this

GetAsyncKeyState('w')

is not working? By "not working", I mean that when I press 'w', it does not react at all as it does with 0x57. How can I fix it? What I want to do is read a character from a file, like 'w', and then use it in GetAsyncKeyState() function. Thanks in advance!

like image 322
user3496846 Avatar asked Mar 19 '23 22:03

user3496846


1 Answers

The ASCII code for 'w' is 0x77 and the ASCII code for 'W' is 0x57. So

GetAsyncKeyState(0x57) 

is the same as

GetAsyncKeyState('W')

which is different from

GetAsyncKeyState('w')

The official table of virtual key codes gives 0x57 as the code for the W key.

like image 88
David Heffernan Avatar answered Apr 29 '23 15:04

David Heffernan