The GetAsyncKeyState() returns 1/0 depending if the valued key passed to the function is pressed or not (and also works when application is out of focus).
With standard characters the keyboard code matches to the ASCII code so you can easily store that key or output it to a file for a key-logger or such. However these keys are always capital (because it's the same key) and also control keys such as PageDn do not have a correct representation compared to the ASCII code so appear as unrelated characters such as ']'
The GetAsyncKeyState() is a windows function to recognise if that key is pressed but windows is obviously is able to interpret the keys properly depending on whether shift is pressed for caps etc. Is there a way to get this already corrected character/control code??
Is there a reason you can't check the state of caps lock and shift to get the proper character? That's sort of the point of GetAsyncKeyState; to test for combinations of keypresses.
Native Windows apps call TranslateMessage to convert keycodes from a WM_KEYDOWN message to character codes for WM_CHAR messages. I wonder if it's possible to spoof a WM_KEYDOWN message whenever a key is pressed, then have your app handle the WM_CHAR message.
I know that i can use combinations of keys for things like characters and the symbols above numbers (whether shift pressed) but then i realized that the computer already does this INSIDE WINDOWS.
If there's a way to get at the already determined ASCII values then this would make the program much easier, much clearer to read, and likely more efficient than re-writing the code myself.
Windows get's the correct character values somehow, surely there must be some way to access this?
Windows get's the correct character values somehow, surely there must be some way to access this?
Sure win32 apps can receive input as characters but only if the input is inside one of their windows. All of the keyboard functions deal with VKeys only.
Why not write a function that behaves the way you want and tuck it away in a separate .cpp file?
I am no authority on Windows programming, so maybe if you post in the Windows board you will get a different answer.
This is a fair enough suggestion for future applications, i'm gonna start some work on this project at the same time as searching for an alternative and easier way todo this because everything must be interpreted somehow and there surely must be someway to get at it.
I guess it all depends whether i make my key capture first or whether i find out how to utilize windows as i need it.
STILL if anyone knows how to access any windows functions that does this it is much appreciated!!!