Currently, I’m using the method VkKeyScan in the Win32 API to convert a character to its virtual-key code. But the problem that this seems to have is that, when i pass small alphabets, it works fine whereas when i pass in a capital alphabet, it doesn’t return the appropriate key code and similarly with special characters like “(” or “}”.
How do i do this? Is there anyway for me to directly convert a string to its virtual equivalent without considering whether it contains capitalized or special characters?
Thanks
You should be clearer in what your requirements are, more specifically in what you consider to be an appropriate key code. The
VkKeyScanas specified in it’s documentation returns the virtual-key code in the low-order byte and the shift state in the high-byte of the return value.This is demonstrated in the code snippet below that uses the
'('character as input for theVkKeyScanmethod.Running this snippet will result in the following output: