Is there a way to translate a character to its corresponding hardware scan code (not the virtual key code)? I need that to communicate with ancient hardware device.
Seems the most direct method would be to use MapVirtualKey or MapVirtualKeyEx which translates from VK-codes to Scan codes.
The character to VK scan code can be gotten using VkKeyScan (extracting the low byte which contains the VK Code according to MS documentation). So to get the scan code of 'X':
UINT VKCode=LOBYTE(VkKeyScan('X'));
UINT ScanCode=MapVirtualKey(VKCode,0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With