Translating Scan Codes to Virtual-Key Codes (Windows CE 5.0)

Windows CE 5.0
Send Feedback

When a key is pressed, the keyboard controller writes the key's scan code into a buffer. A scan code is a number generated whenever a key is pressed or released. Each key on a keyboard has a unique scan code. The keyboard driver's platform development driver (PDD) relies on an interrupt to retrieve the scan code from the buffer. The keyboard driver's model device driver (MDD) converts the scan code to a virtual-key code.

Whether a keyboard transmits AT scan codes or XT scan codes depends on the keyboard. Standard PS/2 keyboard controllers convert XT scan codes into AT scan codes. Some hardware platforms that have PS/2-compatible keyboard connectors might not have controllers that perform the XT scan code to AT scan code translation. Language-specific scan code translation in the sample keyboard drivers is implemented using libraries.

Supporting languages on a hardware platform with a different type of keyboard controller requires that you write a new controller interface library, and, depending on your hardware, possibly an IST library. These new libraries can then be linked with the appropriate translation libraries to produce a complete keyboard driver. More extensive customization might be necessary for custom keyboards.

Note   The Keyboard Layout Generator Tool produces Microsoft® Windows® CE input language and device layout source files for any PS/2 keyboard that Microsoft Windows XP supports. If the Keyboard Layout Generator tool or the XT scan code tables provided do not provide information for your specific keyboard, see Developing International Software, Second Edition, by Microsoft Press.

The following list shows the libraries that are combined to build a keyboard driver:

  • Keyboard controller-specific library
  • Keyboard interrupt service thread (IST)-handling library
  • Scan code to virtual-key code translation library
  • Virtual-key code to character translation library
  • Virtual-key code remapping library

AT Scan Code Translation Libraries

The following table shows the location of the AT scan code to virtual-key code translation libraries for specified keyboard layouts in the %_WINCEROOT%\Public\Common\OAK\Drivers\Keybd\DeviceLayouts\PS2_AT directory. It also shows the language identifier (LANGID) for the libraries. The names of the subdirectories are derived from the input locale (HKL) code. In most cases, the keyboard names in the table corresponds to information in Developing International Software. However, the Japanese keyboard names correspond to their names in the Microsoft Platform Builder Catalog.

AT keyboard layoutSubdirectoryLANGID
Arabic 101000004010x0401
Hebrew0000040D0x040D
Indic-Devanagari-INSCRIPT000104390x0439
Indic-Gujarati000004470x0447
Indic-Kannada0000044B0x044B
Indic-Devanagari-Marathi0000044E0x044E
Indic-Punjabi000004460x0446
Indic-Tamil000004490x0449
Indic-Telugu0000044A0x044A
Japanese (IBM layout)000104110x0411
Japanese (NEC layout)000004110x0411
Korean (Hangul)000004120x0412
Thai (Kedmanee)0000041E0x041E
United States 101000004090x0409
United States-Dvorak000104090x0409

XT Scan Code Translation Libraries

The following table provides links to Help topics for common keyboard layouts. These topics contain translations for various languages for XT scan code to virtual-key code and virtual-key code to Unicode characters. The table also provides the language identifiers (LANGIDs) and the input locale (HKL) codes for the XT scan code translation libraries. In most cases, the keyboard names in the table corresponds to information in Developing International Software.

XT keyboard layoutLANGIDHKL
Brazilian (ABNT) Keyboard0x041600000416
Dutch Keyboard 0x041300000413
French Keyboard0x040C0000040C
German Keyboard 0x040700000407
Italian Keyboard 0x041000000410
Japanese Keyboard 0x0411E0010411
Korean Keyboard0x0412E0010412
Portuguese Keyboard 0x081600000816
Spanish Keyboard 0x040A0000040A
Swedish Keyboard 0x041D0000041D
United Kingdom Keyboard 0x080900000809
United States 101 Keyboard0x040900000409

See Also

Virtual-Key Codes | Keyboard Layout Generator Tool


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show: