Finding Hex Keycodes

1

I am trying to create a program that remaps keys for Windows but I am struggling to find the hex values. I know that caps lock is 3A but when I look up an ascii table it says 3A is colon. Why is this and where can I find the hex codes I'm looking for?

Jordan Baron

Posted 2019-04-05T16:43:25.733

Reputation: 113

Answers

2

You are intercepting keyboard keys at a very low level, so you are not getting characters, but Scancodes, defined as :

A scancode (or scan code) is the data that most computer keyboards send to a computer to report which keys have been pressed. A number, or sequence of numbers, is assigned to each key on the keyboard.

You can see for reference the Table of Keyboard Scan Codes.

Many keys have scancodes, but no ASCII equivalent, for example the CapsLock. Keys that have both scancodes and ASCII equivalent are translated to their ASCII values by Windows, before being transmitted to the program (unless it uses a low-level API call to get the key presses).

harrymc

Posted 2019-04-05T16:43:25.733

Reputation: 306 093

Ok, so ASCII is higher level than Scancodes? – Jordan Baron – 2019-04-05T17:44:42.880

Usually an API that is close to the hardware is called lower-level, while an API that uses these calls is called higher-level. – harrymc – 2019-04-05T19:15:16.203