Keyboard Layout Generator Tool

Keyboard Layout Generator Tool

Windows CE .NET

The Keyboard Layout Generator tool (Kbdgen.exe) produces Windows CE Input Language and Device Layout source files from a Windows XP keyboard layout DLL. Build the Input Language and Device Layout. These can be placed in the same or separate DLLs as long as the registry entries are given appropriately. You must expose the input language and device layout entry points, such as the IL_ and PS2_AT_ entry points.

kbdgen <DLL Name> [-v] [-o <Output File Prefix>] [-i <Input Locale>]


<DLL Name>
The name of the Windows XP keyboard layout DLL. Kbdgen will attempt to load this file from the current directory. If this fails, Kbdgen will then attempt to load the file from the Windows system directory. The keyboard layouts that come with Windows XP can be found in the registry under [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layouts].
Specifies verbose output. This is optional.
-o <Output File Prefix>
Specifies that Kbdgen must write output to a file instead of writing to the console, and defines what prefix to use for the output files. This is optional.
-i <Input Locale>
Specifies that Kbdgen must use the given Input Locale for function names and registry entries. If it is not specified, "XXXXXXXX" will be used and the user will be responsible for changing the name in the files. This is optional.


The following code example shows a Kbdgen search for the file Kbddv.dll in the current directory. Once Kbdgen locates the file, it generates Dvorakil.cpp, Dvoraldl.cpp, and Dvorak.reg, using the input locale 00010409.

kbdgen kbddv.dll –o dvorak –i 00010409


The following list displays the files that Kbdgen generates if you have specified the -o parameter. If you have not, the output is written to console.

<prefix>il.cpp – The Input Language source file.

<prefix>dl.cpp – The Device Layout source file.

<prefix>.reg – Contains sample registry entries that may be used for this layout.

Once these files are generated, you must perform the following tasks for each file type.

File type Tasks
Input Language source file The default keyboard layout uses the right and left Shift, Control, and Alt keys, and the CapsLock, NumLock, and ScrollLock keys as shift or toggle keys.

If your keyboard layout uses different shift or toggle keys, you must add the appropriate conversion tables, VkToToggledStateTable and/or VkToShiftStateTable, to the generated Input Language file.

If the input locale is not specified, fill in the XXXX in the IL_0000XXXX function name with the proper input language identifier.

For example, the Japanese Input Language file, which demonstrates a case where the Kana toggle key is added, is located at %_WINCEROOT%\public\common\oak\drivers\keybd\inputlangs\0411\IL_0411.cpp. Duplicate entries have been removed from the VKeyToXTScanCodeTable array, as described in comments and in console output. Verify that the proper XT scan code is used for these virtual keys.

Device Layout source file This file includes remapping for NumPad keys. When building this file, ensure that the NumPad remapping library is included in your image. This library is located at %_COMMONOAKROOT%\lib\%_CPUINDPATH%\NumPadRmp.lib.

If the input locale is not specified, substitute the proper input locale identifier for the XXXXXXXX in the PS2_AT_XXXXXXXX function name.

Sample Registry File Fill in all the fields in the registry entries.

Choose a Preload index that will not conflict with others installed on the system.

See Also

Layout Manager | Keyboard Drivers

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.

© 2016 Microsoft