Feb 10, 2013 at 10:10pm UTC
Hello, is there any way to convert a string of a key, such as "A" or "Shift" into a char or VK_Keycode?
Thanks.
Last edited on Feb 11, 2013 at 4:33pm UTC
Feb 11, 2013 at 9:56am UTC
No. It depends on the keyboard.
You can hardcode values of particular keyboard, but I don't know how to do it "properly".
Feb 11, 2013 at 4:36pm UTC
That's not what I'm looking for.
Feb 12, 2013 at 9:08pm UTC
Well...
1. Converting "A" into a char is just a case of using operator[]?
2. Isn't the virtual key code keyboard independent? And the hardware specific one the scan code ?
(The virtual key codes are defined as fixed values in WinUser.h
The virtual key codes for A - Z are the ascii values for the corresponding uppercase letter.)
Out of interest, what do you need the codes for??
Andy
Last edited on Feb 12, 2013 at 9:08pm UTC
Feb 12, 2013 at 9:25pm UTC
Ah, looking again I now understand what he means. There is no global way to do it, I think, you should just handle each key manually (Maybe just make a table of possible "long names" and compare)
Feb 12, 2013 at 10:19pm UTC
Ok, thanks. I'll probably make a function for it then.