[Previous][Up] Reference for unit 'keyboard' (#rtl)

Keyboard scan codes

Special physical keys are encoded with the DOS scan codes for these keys in the second byte of the TKeyEvent type. A complete list of scan codes can be found in the below table. This is the list of keys that is used by the default key event translation mechanism. When writing a keyboard driver, either these constants should be returned by the various key event functions, or the TranslateKeyEvent hook should be implemented by the driver.

Key Scancodes
Code Key Code Key Code Key
00 NoKey 3D F3 70 ALT-F9
01 ALT-Esc 3E F4 71 ALT-F10
02 ALT-Space 3F F5 72 CTRL-PrtSc
04 CTRL-Ins 40 F6 73 CTRL-Left
05 SHIFT-Ins 41 F7 74 CTRL-Right
06 CTRL-Del 42 F8 75 CTRL-end
07 SHIFT-Del 43 F9 76 CTRL-PgDn
08 ALT-Back 44 F10 77 CTRL-Home
09 ALT-SHIFT-Back 47 Home 78 ALT-1
0F SHIFT-Tab 48 Up 79 ALT-2
10 ALT-Q 49 PgUp 7A ALT-3
11 ALT-W 4B Left 7B ALT-4
12 ALT-E 4C Center 7C ALT-5
13 ALT-R 4D Right 7D ALT-6
14 ALT-T 4E ALT-GrayPlus 7E ALT-7
15 ALT-Y 4F end 7F ALT-8
16 ALT-U 50 Down 80 ALT-9
17 ALT-I 51 PgDn 81 ALT-0
18 ALT-O 52 Ins 82 ALT-Minus
19 ALT-P 53 Del 83 ALT-Equal
1A ALT-LftBrack 54 SHIFT-F1 84 CTRL-PgUp
1B ALT-RgtBrack 55 SHIFT-F2 85 F11
1E ALT-A 56 SHIFT-F3 86 F12
1F ALT-S 57 SHIFT-F4 87 SHIFT-F11
20 ALT-D 58 SHIFT-F5 88 SHIFT-F12
21 ALT-F 59 SHIFT-F6 89 CTRL-F11
22 ALT-G 5A SHIFT-F7 8A CTRL-F12
23 ALT-H 5B SHIFT-F8 8B ALT-F11
24 ALT-J 5C SHIFT-F9 8C ALT-F12
25 ALT-K 5D SHIFT-F10 8D CTRL-Up
26 ALT-L 5E CTRL-F1 8E CTRL-Minus
27 ALT-SemiCol 5F CTRL-F2 8F CTRL-Center
28 ALT-Quote 60 CTRL-F3 90 CTRL-GreyPlus
29 ALT-OpQuote 61 CTRL-F4 91 CTRL-Down
2B ALT-BkSlash 62 CTRL-F5 94 CTRL-Tab
2C ALT-Z 63 CTRL-F6 97 ALT-Home
2D ALT-X 64 CTRL-F7 98 ALT-Up
2E ALT-C 65 CTRL-F8 99 ALT-PgUp
2F ALT-V 66 CTRL-F9 9B ALT-Left
30 ALT-B 67 CTRL-F10 9D ALT-Right
31 ALT-N 68 ALT-F1 9F ALT-end
32 ALT-M 69 ALT-F2 A0 ALT-Down
33 ALT-Comma 6A ALT-F3 A1 ALT-PgDn
34 ALT-Period 6B ALT-F4 A2 ALT-Ins
35 ALT-Slash 6C ALT-F5 A3 ALT-Del
37 ALT-GreyAst 6D ALT-F6 A5 ALT-Tab
3B F1 6E ALT-F7
3C F2 6F ALT-F8

A list of scan codes for special keys and combinations with the SHIFT, ALT and CTRL keys can be found in the following table: They are for quick reference only.

Special keys scan codes
Key Code SHIFT-Key CTRL-Key Alt-Key
NoKey 00
F1 3B 54 5E 68
F2 3C 55 5F 69
F3 3D 56 60 6A
F4 3E 57 61 6B
F5 3F 58 62 6C
F6 40 59 63 6D
F7 41 5A 64 6E
F8 42 5B 65 6F
F9 43 5C 66 70
F10 44 5D 67 71
F11 85 87 89 8B
F12 86 88 8A 8C
Home 47 77 97
Up 48 8D 98
PgUp 49 84 99
Left 4B 73 9B
Center 4C 8F
Right 4D 74 9D
end 4F 75 9F
Down 50 91 A0
PgDn 51 76 A1
Ins 52 05 04 A2
Del 53 07 06 A3
Tab 8 0F 94 A5
GreyPlus 90 4E

Documentation generated on: Mar 17 2017