The keyboard device driver interprets a scan code and translates (maps) it to a virtual-key code, a device-independent value defined by the system that identifies the purpose of a key. A keyboard generates two scan codes when the user types a key-one when the user presses the key and another when the user releases the key. The keyboard device driver receives scan codes from the keyboard, which are sent to the keyboard layout where they are translated into messages and posted to the appropriate windows in your application.Īssigned to each key on a keyboard is a unique value called a scan code, a device-dependent identifier for the key on the keyboard.
The system provides language-independent keyboard support by using the language-specific keyboard layout currently selected by the user or the application. The system provides device-independent keyboard support for applications by installing a keyboard device driver appropriate for the current keyboard. An application receives keyboard input in the form of messages posted to its windows. Applications should accept user input from the keyboard as well as from the mouse.