6.4 Keyboard Layouts

The layout of a keyboard defines the letters, numbers, and symbols represented by its keys, in addition to the character values generated by pressing the keys. Different keyboard layouts are used in different countries. Users can adapt MS-DOS for these keyboard layouts by using the Keyb program. Programs cannot adapt MS-DOS directly, but they also can use the Keyb program, by starting it as a child program.

At startup, MS-DOS installs a default keyboard layout. When a user or program changes the layout by using the Keyb program, the default layout remains available but inactive. Programs can switch between the new and default layouts by using Set KEYB.COM Country Flag (Interrupt 2Fh Function 0AD82h). (Pressing the CTRL+ALT+F1 or CTRL+ALT+F2 key combination has the same effect.) A program can determine which layout is active by using Get KEYB.COM Country Flag (Interrupt 2Fh Function 0AD83h).

A program can set the keyboard code page by using Set Global Code Page or Set KEYB.COM Active Code Page (Interrupt 2Fh Function 0AD81h). Set KEYB.COM Active Code Page sets only the keyboard's code page; it has no effect on other devices. The current code page determines which character codes are generated for a keyboard's keys. In general, programs should check that the code page for the keyboard matches the code page for the screen.

A program can determine whether the Keyb program is loaded by using Get KEYB.COM Version Number (Interrupt 2Fh Function 0AD80h).

For more information about the keyboard layouts supported by MS-DOS, see the Microsoft MS-DOS User's Guide and Reference.