Partager via


Device Layouts (Windows Embedded CE 6.0)

1/6/2010

A device layout is hardware-specific keyboard information, which includes the scan code to virtual-key code translations, and virtual-key remapping. For example, a Korean PS/2 keyboard has a different device layout than a Korean matrix keyboard.

Because universal serial bus (USB) human interface device (HID) keyboard drivers convert USB keyboard scan codes to AT scan codes, there is no HID device layout. The HID driver calls MapVirtualKey to retrieve the corresponding virtual-key code for the scan code, which uses the device layout associated with the first PDD. This sequence occurs so that the localization of scan codes to virtual-key codes only needs to exist in the device layout. Then, the HID keyboard driver calls keybd_event with the virtual-key code and scan code.

Many device layouts can correspond to one input language. For example, a standard United States 101 device layout and a United States-Dvorak device layout both use US English as the input language.

Layout Manager performs the scan code to virtual-key code mapping. The DeviceLayout.h file describes the related data structures. Layout Manager performs the remapping after the scan code to virtual-key code conversion. Microsoft provides a numeric keypad mapping library for static linking to the device layout's remapping routine so you do not need to duplicate the numeric keypad common code. The numeric keypad library performs mappings such as VK_NUMPAD0 to VK_INSERT when NUMLOCK is off.

** Windows Embedded CE provides default support for the following keyboard layouts:

  • U.S. English keyboard layouts
  • Japanese keyboard layouts
  • Korean keyboard layouts

To support keyboard layouts for additional languages, you must generate a new keyboard layout for that language from Windows XP layout DLLs. You can do this by using the Keyboard Layout Generator Tool (kbdgen). For more information, see Keyboard Layout Generator Tool.

The following code example shows the device layout data structures.

// Remapping function typedefs
typedef UINT (*PFN_KEYBD_REMAP)(
  const KEYBD_EVENT *pKbdEvents, 
  UINT cKbdEvents,
  KEYBD_EVENT *pRmpKbdEvents,  
  UINT cMaxRmpKbdEvents 
);

typedef struct tagDEVICE_LAYOUT {
  DWORD dwSize;
  WORD wPddMask; // Matches the device layout with its PDD

  // Scan code to virtual key
  ScanCodeToVKeyData **rgpscvk;
  UINT cpscvk;

  // Remapping functions
  PFN_KEYBD_REMAP pfnRemapKey;
} DEVICE_LAYOUT, *PDEVICE_LAYOUT;

typedef BOOL (*PFN_DEVICE_LAYOUT_ENTRY)(PDEVICE_LAYOUT pDeviceLayout);

The wPddMask members of the PDD data structure and device layout data structure match the device layout to a PDD. The wPddMask member is a bitmask that can correlate one device layout to multiple PDD types. For example, an AT scan code device layout can correlate to both a PS/2 PDD, and to a stub PDD.

See Also

Concepts

Layout Manager
Device Layout Data