How to translate hardware ascii to hardware scan code in win32

visual-studio, winapi, windows

Solution

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);

Problem

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.

Original source