I am using WinUser.h and need to know if there is a simple way of getting the virtual key of whatever key is pressed on the keyboard.
I have tried GetAsyncKeyState() and it works fine, but I need the actual virtual key to be returned rather than running through a long series of GetAsyncKeyState() calls to check every key on the keyboard.
I am essentially creating a system that allows users to map their controls, which is why it would be more ideal if I could get the virtual key and then run a check against keys that are not allowed.
Also, C++ is the language being used. Thank you for any help in this matter.
You almost certainly want to response to the WM_KEYDOWN/WM_KEYUP or (more likely) WM_CHAR messages.
WM_CHARgive you the result after TranslateMessage does its job, so it’s what you usually want. It’ll give you both the translated virtual key code and the scan code of the key that was pressed, in case you need that as well.