About the KBDTools and KeyboardRemap XML File

The XML file you use for key remapping with the KBDTools functions (C++) or the KeyboardRemap class (C#) includes these elements.

KBDMap Element

Root element in exported key maps. Must be the root or child of the root when importing key maps. Specifies that the contained information will be used for remapping the keyboard.

Child elements:

KBDMap element attributes are described in the next table.

Attribute Name Required or Optional Possible Value Description
Keyboard Optional Keyboard ID string Must match the keyboard ID the map is intended for. If this attribute does not match the Keyboard ID the map will be ignored. This allows multiple maps to be downloaded to each device in mixed device installations. If this attribute is not present, the map is used on all keyboard types.
Date Optional Date and Time string Not currently used, but will be present in exported maps to specify the date and time created.
Absolute Optional 0 or 1 If the value is 0, the map will be combined with the current definitions. If the value is 1, old keyboard definitions will be cleared, and only the definitions in the map will be used on the device.

Normal Element

Contains key definitions for the Normal plane.

Child elements:

This element has no attributes.

Orange Element

Contains key definitions for the Orange plane.

Child elements:

This element has no attributes.

Green Element

Contains key definitions for the Green plane.

Child elements:

This element has no attributes.

Key Element

Contains the definition for a particular key. Each KEY element can be thought of having two parts:

This element has no child elements.

Key element attributes are described in the next table.

Attribute Name Required or Optional Possible Value Description
Page Required 0 to 255 This is the USB HID Page number as used by the Keyboard Driver. The value is 7 for most all normal keys.
Usage Required 0 to 255 USB HID Usage value as used by the driver.
Value Required 0 to 255 The interpretation of this value depends on several of the attributes below.

Assuming the attributes DLLFunc, Modifier, MultiKey, NamedEvent, Rotate, PlaneShift and VKEY are all 0 or absent, this value is the scan code for the key. If the attributes listed are all 0 or absent, except for VKEY="1", then the value is the VKEY value for the key.

If one of DLLFunc, Modifier, MultiKey, NamedEvent, Rotate or PlaneShift is "1", then the Value attribute is interpreted as an index into one of several pre-existing tables of special keys.

Extended Optional 0 or 1. Assumed to be 0 if not present. Used only when the Value attribute represents a scan code, having the Extended attribute defined as "1" means that the extended value 0xE0 accompanies the key.
NoChord Optional 0 or 1. Assumed to be 0 if not present. Used only when the MultiKey attribute is "1". Setting this value to "1" implies that the multiple keys being sent by this keystroke appear to be pressed simultaneously. That is, there is only one WM_KEYDOWN message and one WM_KEYUP message sent around the multiple WM_CHAR messages. Otherwise, each WM_CHAR message is surrounded by a WM_KEYDOWN and a WM_KEYUP message.
NoRepeat Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key will repeat if held down. Otherwise, only one instance of the key press is triggered no matter how long the key is held.
NOOP Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key is disabled. Functionally the same as deleting the key.
Shifted Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key behaves as if the Shift key was pressed while the key is pressed.
Silent Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key click is disabled for this key.
VKEY Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", specifies that the Value attribute holds a VKEY value instead of a scan code.
LED1 Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1" the key press will also light LED1.
LED2 Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1" the key press will also light LED2.
LED3 Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1" the key press will also light LED3.
StickyLock Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1" and the key is pressed once, the key behaves the same as StickyOnce. If this attribute is "1" and the key is pressed twice in a row, the key acts like StickyPersist.
StickyOnce Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1" the key behaves as if it stays pressed until the next key press of any key. This behavior is similar to the behavior of a Shift key.
StickyPersist Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key behaves as if it stays pressed, until the same key is pressed again. This behavior is similar to the behavior of a Caps Lock or Num Lock key.
AppLaunch Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key behaves as a Microsoft Shell Application Launch Key.
Modifier Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key is a modifier key such as Shift, Alt, Control, Caps, etc. The Value attribute is an index into a pre-existing table of shift key definitions in the registry.
MultiKey Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key is a macro key such that a single keypress sends multiple key press events. The Value attribute is an index into a pre-existing table of key macro definitions in the registry.
NamedEvent Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key sets and resets a named event. The Value attribute is an index into a pre-existing table of named event definitions.
DLLFunc Optional 0 or 1.
Assumed to be 0 if not present.
If this attribute is "1", the key triggers a predefined function built into the keyboard driver. Not supported on all devices.
Rotate Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", successive keypresses cycle through a predefined set of values. This is similar in behavior to the keys on a cell phone, such as the 2 key cycling through "A", "B", "C". The Value attribute is an index into a pre-existing table of rotate key definitions.
Unicode Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key returns a predefined Unicode value. The Value attribute is an index into a pre-existing table of Unicode key definitions.
PlaneShift Optional 0 or 1. Assumed to be 0 if not present. If this attribute is "1", the key acts as a Plane Shift key, such as the Orange or Green key. The Value attribute is an index into a pre-existing table of Plane Shift key definitions.

More Information

KeyboardRemap Class