Share via


Translating Scan Codes to Virtual-Key Codes (Windows Embedded CE 6.0)

1/6/2010

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

For Windows Embedded CE, the Keyboard Layout Generator Tool produces Windows Embedded CE input language and device layout source files for any PS/2 keyboard that 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 layout Subdirectory LANGID

Arabic 101

00000401

0x0401

Hebrew

0000040D

0x040D

Indic-Devanagari-INSCRIPT

00010439

0x0439

Indic-Gujarati

00000447

0x0447

Indic-Kannada

0000044B

0x044B

Indic-Devanagari-Marathi

0000044E

0x044E

Indic-Punjabi

00000446

0x0446

Indic-Tamil

00000449

0x0449

Indic-Telugu

0000044A

0x044A

Japanese (IBM layout)

00010411

0x0411

Japanese (NEC layout)

00000411

0x0411

Korean (Hangul)

00000412

0x0412

Thai (Kedmanee)

0000041E

0x041E

United States 101

00000409

0x0409

United States-Dvorak

00010409

0x0409

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 layout LANGID HKL

Brazilian (ABNT) Keyboard

0x0416

00000416

Dutch Keyboard

0x0413

00000413

French Keyboard

0x040C

0000040C

German Keyboard

0x0407

00000407

Italian Keyboard

0x0410

00000410

Japanese Keyboard

0x0411

E0010411

Korean Keyboard

0x0412

E0010412

Portuguese Keyboard

0x0816

00000816

Spanish Keyboard

0x040A

0000040A

Swedish Keyboard

0x041D

0000041D

United Kingdom Keyboard

0x0809

00000809

United States 101 Keyboard

0x0409

00000409

See Also

Concepts

Layout Manager

Other Resources

Virtual Key Codes
Keyboard Layout Generator Tool