DirectX Scan Codes

A scan code is a number assigned to each key on a keyboard. A keyboard reports which keys have been pressed by sending this code to the computer.

Button          Dec
BACKSPACE       8
TAB             9
ENTER           13
CAPS LOCK       20
ESCAPE          27
SPACE           32
PGUP            33
PGDOWN          34
END             35
HOME            36
LEFT            37
UP              38
RIGHT           39
DOWN            40
DELETE          46
0               48
1               49
2               50
3               51
4               52
5               53
6               54
7               55
8               56
9               57
A               65
B               66
C               67
D               68
E               69
F               70
G               71
H               72
I               73
J               74
K               75
L               76
M               77
N               78
O               79
P               80
Q               81
R               82
S               83
T               84
U               85
V               86
W               87
X               88
Y               89
Z               90
SUPER           92
Num0            96
Num1            97
Num2            98
Num3            99
Num4            100
Num5            101
Num6            102
Num7            103
Num8            104
Num9            105
Num*            106
Num+            107
Num-            109
Num.            110
Num/            111
F1              112
F2              113
F3              114
F4              115
F5              116
F6              117
F7              118
F8              119
F9              120
F10             121
F11             122
NUMLOCK         144
SCRLOCK         145
L-SHIFT         160
R-SHIFT         161
L-CTRL          162
R-CTRL          163
L-ALT           164
R-ALT           165
;               186
=               187
,               188
-               189
.               190
/               191
[               219
\               220
]               221
'               222
\               226
Mouse1          256
Mouse2          257
Mouse3          258
Mouse4          259
Mouse5          260


SnippetsEdit

Group KeyCodes
    int Property Backspace = 8 AutoReadOnly
    int Property Tab = 9 AutoReadOnly
    int Property Enter = 13 AutoReadOnly
    int Property CapsLock = 20 AutoReadOnly
    int Property Escape = 27 AutoReadOnly
    int Property Space = 32 AutoReadOnly
    int Property PageUp = 33 AutoReadOnly
    int Property PageDown = 34 AutoReadOnly
    int Property End = 35 AutoReadOnly
    int Property Home = 36 AutoReadOnly
    int Property Left = 37 AutoReadOnly
    int Property Up = 38 AutoReadOnly
    int Property Right = 39 AutoReadOnly
    int Property Down = 40 AutoReadOnly
    int Property Delete = 46 AutoReadOnly
    int Property Number0 = 48 AutoReadOnly
    int Property Number1 = 49 AutoReadOnly
    int Property Number2 = 50 AutoReadOnly
    int Property Number3 = 51 AutoReadOnly
    int Property Number4 = 52 AutoReadOnly
    int Property Number5 = 53 AutoReadOnly
    int Property Number6 = 54 AutoReadOnly
    int Property Number7 = 55 AutoReadOnly
    int Property Number8 = 56 AutoReadOnly
    int Property Number9 = 57 AutoReadOnly
    int Property A = 65 AutoReadOnly
    int Property B = 66 AutoReadOnly
    int Property C = 67 AutoReadOnly
    int Property D = 68 AutoReadOnly
    int Property E = 69 AutoReadOnly
    int Property F = 70 AutoReadOnly
    int Property G = 71 AutoReadOnly
    int Property H = 72 AutoReadOnly
    int Property I = 73 AutoReadOnly
    int Property J = 74 AutoReadOnly
    int Property K = 75 AutoReadOnly
    int Property L = 76 AutoReadOnly
    int Property M = 77 AutoReadOnly
    int Property N = 78 AutoReadOnly
    int Property O = 79 AutoReadOnly
    int Property P = 80 AutoReadOnly
    int Property Q = 81 AutoReadOnly
    int Property R = 82 AutoReadOnly
    int Property S = 83 AutoReadOnly
    int Property T = 84 AutoReadOnly
    int Property U = 85 AutoReadOnly
    int Property V = 86 AutoReadOnly
    int Property W = 87 AutoReadOnly
    int Property X = 88 AutoReadOnly
    int Property Y = 89 AutoReadOnly
    int Property Z = 90 AutoReadOnly
    int Property Super = 92 AutoReadOnly
    int Property NumPad0 = 96 AutoReadOnly
    int Property NumPad1 = 97 AutoReadOnly
    int Property NumPad2 = 98 AutoReadOnly
    int Property NumPad3 = 99 AutoReadOnly
    int Property NumPad4 = 100 AutoReadOnly
    int Property NumPad5 = 101 AutoReadOnly
    int Property NumPad6 = 102 AutoReadOnly
    int Property NumPad7 = 103 AutoReadOnly
    int Property NumPad8 = 104 AutoReadOnly
    int Property NumPad9 = 105 AutoReadOnly
    int Property NumPadAsterisk = 106 AutoReadOnly
    int Property NumPadPlus = 107 AutoReadOnly
    int Property NumPadMinus = 109 AutoReadOnly
    int Property NumPadPeriod = 110 AutoReadOnly
    int Property NumPadFowardSlash = 111 AutoReadOnly
    int Property F1 = 112 AutoReadOnly
    int Property F2 = 113 AutoReadOnly
    int Property F3 = 114 AutoReadOnly
    int Property F4 = 115 AutoReadOnly
    int Property F5 = 116 AutoReadOnly
    int Property F6 = 117 AutoReadOnly
    int Property F7 = 118 AutoReadOnly
    int Property F8 = 119 AutoReadOnly
    int Property F9 = 120 AutoReadOnly
    int Property F10 = 121 AutoReadOnly
    int Property F11 = 122 AutoReadOnly
    int Property NumLock = 144 AutoReadOnly
    int Property ScrLock = 145 AutoReadOnly
    int Property LShift = 160 AutoReadOnly
    int Property RShift = 161 AutoReadOnly
    int Property LCtrl = 162 AutoReadOnly
    int Property RCrtl = 163 AutoReadOnly
    int Property LAlt = 164 AutoReadOnly
    int Property RAlt = 165 AutoReadOnly
    int Property SemiColon = 186 AutoReadOnly
    int Property Equals = 187 AutoReadOnly
    int Property Comma = 188 AutoReadOnly
    int Property Minus = 189 AutoReadOnly
    int Property Period = 190 AutoReadOnly
    int Property ForwardSlash = 191 AutoReadOnly
    int Property LeftBracket = 219 AutoReadOnly
    int Property BackwardSlash01 = 220 AutoReadOnly
    int Property RightBracket = 221 AutoReadOnly
    int Property Apostrophe = 222 AutoReadOnly
    int Property BackwardSlash02 = 226 AutoReadOnly
    int Property Mouse1 = 256 AutoReadOnly
    int Property Mouse2 = 257 AutoReadOnly
    int Property Mouse3 = 258 AutoReadOnly
    int Property Mouse4 = 259 AutoReadOnly
    int Property Mouse5 = 260 AutoReadOnly
EndGroup


NotesEdit

  • It seems that some keys don't fire if they are used by game, such as L-Alt and L-Ctrl. (They must be unused by control scheme).


See AlsoEdit