This appendix contains a list of all the scan codes you can use for input in your programs. Scan codes are used in functions such as KeyHit() or KeyDown() like this:
KeyDown(scancode)
Input the scan code for the key you want to test, and this function will return 1 if the key was pressed.
Many of the following keys won’t appear on your keyboard; some of them are international keys (like the symbol for the Yen) and some of them only exist on advanced keyboards that have extra keys (like the Calculator key). Anyway, you can find any key that you would ever think of using on this list, shown in Table A.1
Keyboard Key | Scan Code | Comments |
---|---|---|
ESCAPE | 1 | |
1 | 2 | |
2 | 3 | |
3 | 4 | |
4 | 5 | |
5 | 6 | |
6 | 7 | |
7 | 8 | |
8 | 9 | |
9 | 10 | |
0 | 11 | |
Minus (–) | 12 | On main keyboard |
Equals sign (=) | 13 | |
Backspace | 14 | Backspace key |
Tab | 15 | |
Q | 16 | |
W | 17 | |
E | 18 | |
R | 19 | |
T | 20 | |
Y | 21 | |
U | 22 | |
I | 23 | |
O | 24 | |
P | 25 | |
Left bracket ([) | 26 | |
Right bracket (]) | 27 | |
Return/Enter | 28 | Return/Enter on main keyboard |
Left control | 29 | |
A | 30 | |
S | 31 | |
D | 32 | |
F | 33 | |
G | 34 | |
H | 35 | |
J | 36 | |
K | 37 | |
L | 38 | |
Semicolon (;) | 39 | |
Apostrophe (’) | 40 | |
Grave | 41 | Accent grave |
Left shift | 42 | |
Backslash () | 43 | |
Z | 44 | |
X | 45 | |
C | 46 | |
V | 47 | |
B | 48 | |
N | 49 | |
M | 50 | |
Comma (,) | 51 | |
Period (.) | 52 | On main keyboard |
Slash (/) | 53 | On main keyboard |
Right shift | 54 | |
Multiply (*) | 55 | On numeric keypad |
Left Alt/menu | 56 | |
Space | 57 | |
Capital | 58 | |
F1 | 59 | |
F2 | 60 | |
F3 | 61 | |
F4 | 62 | |
F5 | 63 | |
F6 | 64 | |
F7 | 65 | |
F8 | 66 | |
F9 | 67 | |
F10 | 68 | |
NumLock | 69 | |
Scroll Lock | 70 | |
NumPad 7 | 71 | |
NumPad 8 | 72 | |
NumPad 9 | 73 | |
Subtract ( ) | 74 | On numeric keypad |
NumPad 4 | 75 | |
NumPad 5 | 76 | |
NumPad 6 | 77 | |
Add (+) | 78 | On numeric keypad |
NumPad 1 | 79 | |
NumPad 2 | 80 | |
NumPad 3 | 81 | |
NumPad 0 | 82 | |
Decimal (.) | 86 | On numeric keypad |
OEM_102 | 87 | On UK and German keyboards |
F11 | 87 | |
F12 | 88 | |
F13 | 100 | (NEC PC98) |
F14 | 101 | (NEC PC98) |
F15 | 102 | (NEC PC98) |
Kana | 112 | On Japanese keyboards |
ABNT_C1 | 115 | /? On Portuguese (Brazilian) keyboards |
Convert | 121 | On Japanese keyboards |
NoConvert | 123 | On Japanese keyboards |
Yen | 125 | On Japanese keyboards |
ABNT_C2 | 126 | Numpad on Portuguese (Brazilian) keyboards |
Equals | 141 | Equals (=) on numeric keypad (NEC PC98) |
PrevTrack | 144 | Previous Track (DIK_CIRCUMFLEX) on Japanese keyboards |
AT | 145 | (NEC PC98) |
Colon (:) | 146 | (NEC PC98) |
Underline | 147 | (NEC PC98) |
Kanji | 148 | On Japanese keyboards |
Stop | 149 | (NEC PC98) |
AX | 150 | Japan AX |
Unlabeled | 151 | (J3100) |
Next track | 153 | Next Track |
Enter | 156 | Enter on numeric keypad |
Right control | 157 | |
Mute | 160 | Mute |
Calculator | 161 | Calculator |
Play/Pause | 162 | Play/pause |
Media stop | 164 | Media stop |
Volume down | 174 | Volume - |
Volume up | 176 | Volume + |
Web home | 178 | Web home |
Comma (,) | 179 | On numeric keypad (NEC PC98) |
Divide (/) | 181 | On numeric keypad |
SysReq | 183 | |
Right Alt/menu | 184 | Right Alt |
Pause | 197 | Pause |
Home | 199 | Home on Arrow keypad |
Up | 200 | Up Arrow on Arrow keypad |
Page Up/Prior | 201 | Page Up on Arrow keypad |
Left | 203 | Left Arrow on Arrow keypad |
Right | 205 | Right Arrow on Arrow keypad |
End | 207 | End Key on Arrow keypad |
Down | 208 | Down Arrow on Arrow keypad |
Next | 209 | Next Key on Arrow keypad |
Insert | 210 | Insert Key on Arrow keypad |
Delete | 211 | Delete Key on Arrow keypad |
Left Windows | 219 | Left Windows key |
Right Windows | 220 | Right Windows key |
Apps | 221 | Apps Menu key |
Power | 222 | System power |
Sleep | 223 | System sleep |
Wake | 227 | System wake |
Web search | 229 | |
Web favorites | 230 | |
Web refresh | 231 | |
Web stop | 232 | |
Web forward | 233 | |
Web back | 234 | |
My Computer | 235 | |
236 | ||
Media select | 237 |
18.224.58.33