ScanCodes
Parameters
| None. |
Description
|
A reference list of the keyboard scancodes used by KeyDown and KeyHit. This is not a command - it is the lookup table you come here for when you need the number of a key. KeyDown and KeyHit both take a scancode, which identifies a key by where it sits on the keyboard rather than by the character it types. The handful worth memorising: 1 is Escape, 28 is Return, 57 is Space, and 200, 208, 203 and 205 are up, down, left and right. Everything else is in the table below. Scancodes are the wrong tool for typed text, because they tell you nothing about Shift or the keyboard layout. For a name entry box or a chat line use GetKey or WaitKey instead, which hand back character codes. Declaring your keys as constants near the top of the program - Const KEY_FIRE = 57 - keeps the numbers out of your game logic and makes remapping them a five minute job. See also: KeyDown, KeyHit, GetKey, WaitKey, FlushKeys. |
Scancode table
| KEYBOARD KEY | SCANCODE | 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 (=) | 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 | |
| Semi-Colon (;) | 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 (.) | 83 | On Numeric Keypad |
| OEM_102 | 86 | On UK/Germany Keyboards |
| F11 | 87 | |
| F12 | 88 | |
| F13 | 100 | (NEC PC98) |
| F14 | 101 | (NEC PC98) |
| F15 | 102 | (NEC PC98) |
| Kana | 112 | Japanese Keyboard |
| ABNT_C1 | 115 | /? on Portugese (Brazilian) keyboards |
| Convert | 121 | Japanese Keyboard |
| NoConvert | 123 | Japanese Keyboard |
| Yen | 125 | Japanese Keyboard |
| ABNT_C2 | 126 | Numpad . on Portugese (Brazilian) keyboards |
| Equals | 141 | = on numeric keypad (NEC PC98) |
| PrevTrack | 144 | Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) |
| AT | 145 | (NEC PC98) |
| Colon (:) | 146 | (NEC PC98) |
| Underline | 147 | (NEC PC98) |
| Kanji | 148 | Japanese Keyboard |
| 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 (NEX PC98) |
| Divide (/) | 181 | On Numeric Keypad |
| SysReq | 183 | |
| Right Alt/Menu | 184 | Right Alt |
| Pause | 197 | Pause |
| Home | 199 | Home on Arrow Pad |
| 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 Key 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 |
Index