How I can determine which key is pressed on keyboard in C++ using WINAPI?
I try to use GetAsyncKeyState
, but it work just for exactly one key, and I need to choose which one, but I need to get keyсode to it be send over tcp.
How I can determine which key is pressed on keyboard in C++ using WINAPI?
I try to use GetAsyncKeyState
, but it work just for exactly one key, and I need to choose which one, but I need to get keyсode to it be send over tcp.
Loop over every character and try each one:
for (char i = 32; i < 127; i++)
if (GetAsyncKeyState (i))
/* Do whatever you want with that character */;
In the example I loop just from ' ' to '~', modify it as you want.