Convert string to key

Hello, is there any way to convert a string of a key, such as "A" or "Shift" into a char or VK_Keycode?
Last edited on
No. It depends on the keyboard.

You can hardcode values of particular keyboard, but I don't know how to do it "properly".
Oh, ok.
That's not what I'm looking for.

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??

Last edited on
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)
Ok, thanks. I'll probably make a function for it then.
Topic archived. No new replies allowed.