DIK KeyCodes
Each key on any keyboard has a unique Direct Input Keyboard (DIK) code. They are not character symbols. They refer to the position of the key on the keyboard. In other words, depending on the keyboard layout, the actual key can change, but its position is always identical. This is useful to fulfill ergonomic needs.
In addition to that, using DIK codes has more advantages:
- Recognize keys that can not be represented in character equivalents. Function keys for example have no character set code.
- Using the defines below, makes using key codes easier in configs, since the actual code is replaced by a memorable string e.g., DIK_K instead of 0x25.
- Unique DIK codes exist for numeric pad '9' versus standard key '9'. These are key-codes, not, characters.
Usage in scripts
DIK codes are always accompanied by the state of the SHIFT, ALT, and CTRL keys. Any script can differentiate between 'Q' and ALT-Q.
Example Script
#include "\a3\ui_f\hpp\definedikcodes.inc"
params ["_ctrl","_button","_BtnShift","_BtnCtrl","_BtnAlt"];
private _buttonDisabled = false; // true: block the original comand, false: Execute the normal command of that button
private _blockInput = { _ButtonDisabled = true; };
if (_button isEqualTo DIK_W) then // DIK_W = 17 = 0x11 = "W"
{
// For now, button W is just registered, but won't block the original command for now (player can move forward).
// If SHIFT is pressed, block "W" (walk forward) and show the systemchat message
if (_BtnShift) then
{
systemChat "Shift+W pressed";
call _blockInput; // call to disable the original command
};
};
_buttonDisabled
Defines
Header
Personal Tools
#include "\bin\dikCodes.h"
Arma 3
#include "\a3\ui_f\hpp\definedikcodes.inc"
DIK Codes for QWERTY
Key | Type | DIK ID | Hexadecimal | Integer | Note |
---|---|---|---|---|---|
F1 | F1..F15 | DIK_F1 | 0x3B | 59 | N/A |
F2 | F1..F15 | DIK_F2 | 0x3C | 60 | N/A |
F3 | F1..F15 | DIK_F3 | 0x3D | 61 | N/A |
F4 | F1..F15 | DIK_F4 | 0x3E | 62 | N/A |
F5 | F1..F15 | DIK_F5 | 0x3F | 63 | N/A |
F6 | F1..F15 | DIK_F6 | 0x40 | 64 | N/A |
F7 | F1..F15 | DIK_F7 | 0x41 | 65 | N/A |
F8 | F1..F15 | DIK_F8 | 0x42 | 66 | N/A |
F9 | F1..F15 | DIK_F9 | 0x43 | 67 | N/A |
F10 | F1..F15 | DIK_F10 | 0x44 | 68 | N/A |
F11 | F1..F15 | DIK_F11 | 0x57 | 87 | N/A |
F12 | F1..F15 | DIK_F12 | 0x58 | 88 | N/A |
F13 | F1..F15 | DIK_F13 | 0x64 | 100 | NEC PC98 |
F14 | F1..F15 | DIK_F14 | 0x65 | 101 | NEC PC98 |
F15 | F1..F15 | DIK_F15 | 0x66 | 102 | NEC PC98 |
0 | 0..9 | DIK_0 | 0x0B | 11 | N/A |
1 | 0..9 | DIK_1 | 0x02 | 2 | N/A |
2 | 0..9 | DIK_2 | 0x03 | 3 | N/A |
3 | 0..9 | DIK_3 | 0x04 | 4 | N/A |
4 | 0..9 | DIK_4 | 0x05 | 5 | N/A |
5 | 0..9 | DIK_5 | 0x06 | 6 | N/A |
6 | 0..9 | DIK_6 | 0x07 | 7 | N/A |
7 | 0..9 | DIK_7 | 0x08 | 8 | N/A |
8 | 0..9 | DIK_8 | 0x09 | 9 | N/A |
9 | 0..9 | DIK_9 | 0x0A | 10 | N/A |
0 | Numpad | DIK_NUMPAD0 | 0x52 | 82 | N/A |
1 | Numpad | DIK_NUMPAD1 | 0x4F | 79 | N/A |
2 | Numpad | DIK_NUMPAD2 | 0x50 | 80 | N/A |
3 | Numpad | DIK_NUMPAD3 | 0x51 | 81 | N/A |
4 | Numpad | DIK_NUMPAD4 | 0x4B | 75 | N/A |
5 | Numpad | DIK_NUMPAD5 | 0x4C | 76 | N/A |
6 | Numpad | DIK_NUMPAD6 | 0x4D | 77 | N/A |
7 | Numpad | DIK_NUMPAD7 | 0x47 | 71 | N/A |
8 | Numpad | DIK_NUMPAD8 | 0x48 | 72 | N/A |
9 | Numpad | DIK_NUMPAD9 | 0x49 | 73 | N/A |
A | A..Z | DIK_A | 0x1E | 30 | N/A |
B | A..Z | DIK_B | 0x30 | 48 | N/A |
C | A..Z | DIK_C | 0x2E | 46 | N/A |
D | A..Z | DIK_D | 0x20 | 32 | N/A |
E | A..Z | DIK_E | 0x12 | 18 | N/A |
F | A..Z | DIK_F | 0x21 | 33 | N/A |
G | A..Z | DIK_G | 0x22 | 34 | N/A |
H | A..Z | DIK_H | 0x23 | 35 | N/A |
I | A..Z | DIK_I | 0x17 | 23 | N/A |
J | A..Z | DIK_J | 0x24 | 36 | N/A |
K | A..Z | DIK_K | 0x25 | 37 | N/A |
L | A..Z | DIK_L | 0x26 | 38 | N/A |
M | A..Z | DIK_M | 0x32 | 50 | N/A |
N | A..Z | DIK_N | 0x31 | 49 | N/A |
O | A..Z | DIK_O | 0x18 | 24 | N/A |
P | A..Z | DIK_P | 0x19 | 25 | N/A |
Q | A..Z | DIK_Q | 0x10 | 16 | N/A |
R | A..Z | DIK_R | 0x13 | 19 | N/A |
S | A..Z | DIK_S | 0x1F | 31 | N/A |
T | A..Z | DIK_T | 0x14 | 20 | N/A |
U | A..Z | DIK_U | 0x16 | 22 | N/A |
V | A..Z | DIK_V | 0x2F | 47 | N/A |
W | A..Z | DIK_W | 0x11 | 17 | N/A |
X | A..Z | DIK_X | 0x2D | 45 | N/A |
Y | A..Z | DIK_Y | 0x15 | 21 | N/A |
Z | A..Z | DIK_Z | 0x2C | 44 | N/A |
Escape | Control key | DIK_ESCAPE | 0x01 | 1 | N/A |
Tab | Control key | DIK_TAB | 0x0F | 15 | N/A |
Shift (left) | Control key | DIK_LSHIFT | 0x2A | 42 | N/A |
Shift (right) | Control key | DIK_RSHIFT | 0x36 | 54 | N/A |
Control (left) | Control key | DIK_LCONTROL | 0x1D | 29 | N/A |
Control (right) | Control key | DIK_RCONTROL | 0x9D | 157 | N/A |
Backspace | Control key | DIK_BACK | 0x0E | 14 | N/A |
Control key | DIK_BACKSPACE | DIK_BACK | N/A | ||
Enter (main) | Control key | DIK_RETURN | 0x1C | 28 | N/A |
Enter (numpad) | Control key | DIK_NUMPADENTER | 0x9C | 156 | N/A |
Alt (left) | Control key | DIK_LMENU | 0x38 | 56 | N/A |
Control key | DIK_LALT | DIK_LMENU | N/A | ||
Control key | DIK_SPACE | 0x39 | 57 | N/A | |
Caps lock | Control key | DIK_CAPITAL | 0x3A | 58 | N/A |
Caps lock | Control key | DIK_CAPSLOCK | DIK_CAPITAL | N/A | |
Num lock (numpad) | Control key | DIK_NUMLOCK | 0x45 | 69 | N/A |
Scroll lock | Control key | DIK_SCROLL | 0x46 | 70 | N/A |
Menu button | Control key | DIK_RMENU | 0xB8 | 184 | N/A |
Alt (right) | Control key | DIK_RALT | DIK_RMENU | N/A | |
Graphics | DIK_AT | 0x91 | 145 | NEC PC98 | |
Graphics | DIK_COLON | 0x92 | 146 | NEC PC98 | |
Graphics | DIK_UNDERLINE | 0x93 | 147 | NEC PC98 | |
Minus (on main keyboard) | Graphics | DIK_MINUS | 0x0C | 12 | N/A |
Graphics | DIK_EQUALS | 0x0D | 13 | N/A | |
Graphics | DIK_LBRACKET | 0x1A | 26 | N/A | |
Graphics | DIK_RBRACKET | 0x1B | 27 | N/A | |
Semicolon | Graphics | DIK_SEMICOLON | 0x27 | 39 | N/A |
Apostrophe | Graphics | DIK_APOSTROPHE | 0x28 | 40 | N/A |
Accent grave | Graphics | DIK_GRAVE | 0x29 | 41 | N/A |
Backslash | Graphics | DIK_BACKSLASH | 0x2B | 43 | N/A |
Comma | Graphics | DIK_COMMA | 0x33 | 51 | N/A |
Period (main) | Graphics | DIK_PERIOD | 0x34 | 52 | N/A |
Slash (main) | Graphics | DIK_SLASH | 0x35 | 53 | N/A |
* (numpad) | Graphics | DIK_MULTIPLY | 0x37 | 55 | N/A |
* (numpad) | Graphics | DIK_NUMPADSTAR | DIK_MULTIPLY | N/A | |
- (numpad) | Graphics | DIK_SUBTRACT | 0x4A | 74 | N/A |
+ (numpad) | Graphics | DIK_ADD | 0x4E | 78 | N/A |
. (numpad) | Graphics | DIK_DECIMAL | 0x53 | 83 | N/A |
= (numpad) | Graphics | DIK_NUMPADEQUALS | 0x8D | 141 | NEC PC98 |
- (numpad) | Graphics | DIK_NUMPADMINUS | DIK_SUBTRACT | N/A | |
+ (numpad) | Graphics | DIK_NUMPADPLUS | DIK_ADD | N/A | |
. (numpad) | Graphics | DIK_NUMPADPERIOD | DIK_DECIMAL | N/A | |
/ (numpad) | Graphics | DIK_NUMPADSLASH | DIK_DIVIDE | N/A | |
KataKana | DIK_KANA | 0x70 | 112 | Japanese keyboard | |
KataKana | DIK_ABNT_C1 | 0x73 | 115 | / ? on Portugese (Brazilian) keyboards | |
KataKana | DIK_CONVERT | 0x79 | 121 | Japanese keyboard | |
KataKana | DIK_NOCONVERT | 0x7B | 123 | Japanese keyboard | |
KataKana | DIK_YEN | 0x7D | 125 | Japanese keyboard | |
KataKana | DIK_OEM_102 | 0x56 | 86 | on UK/Germany keyboards | |
KataKana | DIK_ABNT_C2 | 0x7E | 126 | Numpad . on Portugese (Brazilian) keyboards | |
KataKana | DIK_PREVTRACK | 0x90 | 144 | Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) | |
KataKana | DIK_KANJI | 0x94 | 148 | Japanese keyboard | |
KataKana | DIK_STOP | 0x95 | 149 | NEC PC98 | |
KataKana | DIK_AX | 0x96 | 150 | Japan AX | |
KataKana | DIK_UNLABELED | 0x97 | 151 | J3100 | |
KataKana | DIK_NUMPADCOMMA | 0xB3 | 179 | , on numeric keypad - NEC PC98 | |
KataKana | DIK_CIRCUMFLEX | DIK_PREVTRACK | Japanese keyboard | ||
Apps | DIK_NEXTTRACK | 0x99 | 153 | Next Track | |
Apps | DIK_MUTE | 0xA0 | 160 | Mute | |
Apps | DIK_CALCULATOR | 0xA1 | 161 | Calculator | |
Apps | DIK_PLAYPAUSE | 0xA2 | 162 | Play / Pause | |
Apps | DIK_MEDIASTOP | 0xA4 | 164 | Media Stop | |
Apps | DIK_VOLUMEDOWN | 0xAE | 174 | Volume - | |
Apps | DIK_VOLUMEUP | 0xB0 | 176 | Volume + | |
Apps | DIK_WEBHOME | 0xB2 | 178 | Web home | |
Apps | DIK_SYSRQ | 0xB7 | 183 | N/A | |
Apps | DIK_PAUSE | 0xC5 | 197 | Pause | |
Apps | DIK_APPS | 0xDD | 221 | AppMenu key | |
Apps | DIK_POWER | 0xDE | 222 | System Power | |
Apps | DIK_SLEEP | 0xDF | 223 | System Sleep | |
Apps | DIK_WAKE | 0xE3 | 227 | System Wake | |
Apps | DIK_WEBSEARCH | 0xE5 | 229 | Web Search | |
Apps | DIK_WEBFAVORITES | 0xE6 | 230 | Web Favorites | |
Apps | DIK_WEBREFRESH | 0xE7 | 231 | Web Refresh | |
Apps | DIK_WEBSTOP | 0xE8 | 232 | Web Stop | |
Apps | DIK_WEBFORWARD | 0xE9 | 233 | Web Forward | |
Apps | DIK_WEBBACK | 0xEA | 234 | Web Back | |
Apps | DIK_MYCOMPUTER | 0xEB | 235 | My Computer | |
Apps | DIK_MAIL | 0xEC | 236 | ||
Apps | DIK_MEDIASELECT | 0xED | 237 | Media Select | |
ArrowKeypad | DIK_HOME | 0xC7 | 199 | Home on arrow keypad | |
ArrowKeypad | DIK_UP | 0xC8 | 200 | UpArrow on arrow keypad | |
ArrowKeypad | DIK_PRIOR | 0xC9 | 201 | PgUp on arrow keypad | |
ArrowKeypad | DIK_LEFT | 0xCB | 203 | LeftArrow on arrow keypad | |
ArrowKeypad | DIK_RIGHT | 0xCD | 205 | RightArrow on arrow keypad | |
ArrowKeypad | DIK_END | 0xCF | 207 | End on arrow keypad | |
ArrowKeypad | DIK_DOWN | 0xD0 | 208 | DownArrow on arrow keypad | |
ArrowKeypad | DIK_NEXT | 0xD1 | 209 | PgDn on arrow keypad | |
ArrowKeypad | DIK_INSERT | 0xD2 | 210 | Insert on arrow keypad | |
ArrowKeypad | DIK_DELETE | 0xD3 | 211 | Delete on arrow keypad | |
ArrowKeypad | DIK_UPARROW | DIK_UP | UpArrow on arrow keypad | ||
ArrowKeypad | DIK_PGUP | DIK_PRIOR | PgUp on arrow keypad | ||
ArrowKeypad | DIK_LEFTARROW | DIK_LEFT | LeftArrow on arrow keypad | ||
ArrowKeypad | DIK_RIGHTARROW | DIK_RIGHT | RightArrow on arrow keypad | ||
ArrowKeypad | DIK_DOWNARROW | DIK_DOWN | DownArrow on arrow keypad | ||
ArrowKeypad | DIK_PGDN | DIK_NEXT | PgDn on arrow keypad | ||
OS key (left) | Other | DIK_LWIN | 0xDB | 219 | Left Windows key |
OS key (right) | Other | DIK_RWIN | 0xDC | 220 | Right Windows key |
German keyboard
Number | Key Name | Number | Key Name | Number | Key Name |
---|---|---|---|---|---|
1 | ESC | 11 | 0 | 21 | Z |
2 | 1 | 12 | ß | 22 | U |
3 | 2 | 13 | ´ | 23 | I |
4 | 3 | 14 | BACKSPACE | 24 | O |
5 | 4 | 15 | TAB | 25 | P |
6 | 5 | 16 | Q | 26 | Ü |
7 | 6 | 17 | W | ||
8 | 7 | 18 | E | 28 | ENTER |
9 | 8 | 19 | R | 29 | STRGL |
10 | 9 | 20 | T | 30 | A |
31 | S | 41 | ^ | 51 | , |
32 | D | 42 | SHIFTL | 52 | . |
33 | F | 43 | # | 53 | - |
34 | G | 44 | Y | 54 | SHIFTR |
35 | H | 45 | X | 55 | NUM_* |
36 | J | 46 | C | 56 | ALT |
37 | K | 47 | V | 57 | SPACE |
38 | L | 48 | B | 58 | CAPS |
39 | Ö | 49 | N | 59 | F1 |
40 | Ä | 50 | M | 60 | F2 |
61 | F3 | 71 | NUM_7 | 81 | NUM_3 |
62 | F4 | 72 | NUM_8 | 82 | NUM_0 |
63 | F5 | 73 | NUM_9 | 83 | NUM_, |
64 | F6 | 74 | NUM_- | ||
65 | F7 | 75 | NUM_4 | ||
66 | F8 | 76 | NUM_5 | 86 | < |
67 | F9 | 77 | NUM_6 | 87 | F11 |
68 | F10 | 78 | NUM_+ | 88 | F12 |
69 | NUM | 79 | NUM_1 | ||
70 | SCROLL | 80 | NUM_2 | ||
156 | NUM_ENTER | 200 | UP | 211 | DELETE |
157 | STRGR | 201 | PAGEUP | 219 | WINR |
220 | WINL | ||||
181 | NUM_/ | 203 | LEFT | 221 | APP |
183 | |||||
184 | ALTGR | 205 | RIGHT | NOT DEFINED | + |
197 | PAUSE | 207 | END | ||
199 | POS1 | 208 | DOWN | ||
209 | PAGEDOWN | ||||
210 | INSERT |
French keyboard
Number | Key Name | Number | Key Name | Number | Key Name |
---|---|---|---|---|---|
1 | ESC | 11 | 0 | 21 | Y |
2 | 1 | 12 | ) | 22 | U |
3 | 2 | 13 | = | 23 | I |
4 | 3 | 14 | BACKSPACE | 24 | O |
5 | 4 | 15 | TAB | 25 | P |
6 | 5 | 16 | A | 26 | ^ |
7 | 6 | 17 | Z | 27 | $ |
8 | 7 | 18 | E | 28 | ENTER |
9 | 8 | 19 | R | 29 | CTRLG |
10 | 9 | 20 | T | 30 | Q |
31 | S | 41 | ² | 51 | ; |
32 | D | 42 | SHIFTL | 52 | : |
33 | F | 43 | * | 53 | ! |
34 | G | 44 | W | 54 | SHIFTR |
35 | H | 45 | X | 55 | NUM_* |
36 | J | 46 | C | 56 | ALT |
37 | K | 47 | V | 57 | SPACE |
38 | L | 48 | B | 58 | CAPS |
39 | M | 49 | N | 59 | F1 |
40 | ù | 50 | , | 60 | F2 |
61 | F3 | 71 | NUM_7 | 81 | NUM_3 |
62 | F4 | 72 | NUM_8 | 82 | NUM_0 |
63 | F5 | 73 | NUM_9 | 83 | NUM_. |
64 | F6 | 74 | NUM_- | ||
65 | F7 | 75 | NUM_4 | ||
66 | F8 | 76 | NUM_5 | 86 | < |
67 | F9 | 77 | NUM_6 | 87 | F11 |
68 | F10 | 78 | NUM_+ | 88 | F12 |
69 | NUM | 79 | NUM_1 | ||
70 | SCROLL | 80 | NUM_2 | ||
156 | NUM_ENTER | 200 | UP | 211 | DELETE |
157 | CTRLR | 201 | PAGEUP | 219 | WINR |
220 | WINL | ||||
181 | NUM_/ | 203 | LEFT | 221 | APP |
183 | |||||
184 | ALTGR | 205 | RIGHT | NOT DEFINED | + |
197 | PAUSE | 207 | END | ||
199 | POS1 | 208 | DOWN | ||
209 | PAGEDOWN | ||||
210 | INSERT |