Keyboard Device Constants

Keyboard device constants, defined in Dinput.h, represent offsets within a keyboard device's data packet, a 256-byte array. The data at a given offset is associated with a keyboard key. Typically, these values will be used in the dwOfs member of the DIDEVICEOBJECTDATA, DIOBJECTDATAFORMAT or DIDEVICEOBJECTINSTANCE structures, or as indices when accessing data within the array using array notation.

The standard keyboard device constants are the following (in ascending order):

Constant Note
DIK_ESCAPE  
DIK_1 On main keyboard
DIK_2 On main keyboard
DIK_3 On main keyboard
DIK_4 On main keyboard
DIK_5 On main keyboard
DIK_6 On main keyboard
DIK_7 On main keyboard
DIK_8 On main keyboard
DIK_9 On main keyboard
DIK_0 On main keyboard
DIK_MINUS On main keyboard
DIK_EQUALS On main keyboard
DIK_BACK The BACKSPACE key
DIK_TAB  
DIK_Q  
DIK_W  
DIK_E  
DIK_R  
DIK_T  
DIK_Y  
DIK_U  
DIK_I  
DIK_O  
DIK_P  
DIK_LBRACKET The [ key
DIK_RBRACKET The ] key
DIK_RETURN ENTER key on main keyboard
DIK_LCONTROL Left CTRL key
DIK_A  
DIK_S  
DIK_D  
DIK_F  
DIK_G  
DIK_H  
DIK_J  
DIK_K  
DIK_L  
DIK_SEMICOLON  
DIK_APOSTROPHE  
DIK_GRAVE Grave accent (`) key
DIK_LSHIFT Left SHIFT key
DIK_BACKSLASH  
DIK_Z  
DIK_X  
DIK_C  
DIK_V  
DIK_B  
DIK_N  
DIK_M  
DIK_COMMA  
DIK_PERIOD On main keyboard
DIK_SLASH Forward slash on main keyboard
DIK_RSHIFT Right SHIFT key
DIK_MULTIPLY The * key on numeric keypad
DIK_LMENU Left ALT key
DIK_SPACE SPACEBAR
DIK_CAPITAL CAPS LOCK key
DIK_F1  
DIK_F2  
DIK_F3  
DIK_F4  
DIK_F5  
DIK_F6  
DIK_F7  
DIK_F8  
DIK_F9  
DIK_F10  
DIK_NUMLOCK  
DIK_SCROLL SCROLL LOCK
DIK_NUMPAD7  
DIK_NUMPAD8  
DIK_NUMPAD9  
DIK_SUBTRACT MINUS SIGN on numeric keypad
DIK_NUMPAD4  
DIK_NUMPAD5  
DIK_NUMPAD6  
DIK_ADD PLUS SIGN on numeric keypad
DIK_NUMPAD1  
DIK_NUMPAD2  
DIK_NUMPAD3  
DIK_NUMPAD0  
DIK_DECIMAL PERIOD (decimal point) on numeric keypad
DIK_F11  
DIK_F12  
DIK_F13  
DIK_F14  
DIK_F15  
DIK_KANA On Japanese keyboard
DIK_CONVERT On Japanese keyboard
DIK_NOCONVERT On Japanese keyboard
DIK_YEN On Japanese keyboard
DIK_NUMPADEQUALS On numeric keypad (NEC PC98)
DIK_CIRCUMFLEX On Japanese keyboard
DIK_AT On Japanese keyboard
DIK_COLON On Japanese keyboard
DIK_UNDERLINE On Japanese keyboard
DIK_KANJI On Japanese keyboard
DIK_STOP On Japanese keyboard
DIK_AX On Japanese keyboard
DIK_UNLABELED On Japanese keyboard
DIK_NUMPADENTER  
DIK_RCONTROL Right CTRL key
DIK_NUMPADCOMMA COMMA on NEC PC98 numeric keypad
DIK_DIVIDE Forward slash on numeric keypad
DIK_SYSRQ  
DIK_RMENU Right ALT key
DIK_HOME  
DIK_UP UP ARROW
DIK_PRIOR PAGE UP
DIK_LEFT LEFT ARROW
DIK_RIGHT RIGHT ARROW
DIK_END  
DIK_DOWN DOWN ARROW
DIK_NEXT PAGE DOWN
DIK_INSERT  
DIK_DELETE  
DIK_LWIN Left Windows key
DIK_RWIN Right Windows key
DIK_APPS Application key
DIK_PAUSE  

The following alternate names are available:

Alternate name Regular name Note
DIK_BACKSPACE DIK_BACK BACKSPACE
DIK_NUMPADSTAR DIK_MULTIPLY * key on numeric keypad
DIK_LALT DIK_LMENU Left ALT
DIK_CAPSLOCK DIK_CAPITAL CAPSLOCK
DIK_NUMPADMINUS DIK__SUBTRACT Minus key on numeric keypad
DIK_NUMPADPLUS DIK_ADD Plus key on numeric keypad
DIK_NUMPADPERIOD DIK_DECIMAL Period key on numeric keypad
DIK_NUMPADSLASH DIK__DIVIDE Forward slash on numeric keypad
DIK_RALT DIK_RMENU Right ALT
DIK_UPARROW DIK_UP On arrow keypad
DIK_PGUP DIK_PRIOR On arrow keypad
DIK_LEFTARROW DIK_LEFT On arrow keypad
DIK_RIGHTARROW DIK_RIGHT On arrow keypad
DIK_DOWNARROW DIK_DOWN On arrow keypad
DIK_PGDN DIK_NEXT On arrow keypad

For information on Japanese keyboards, see DirectInput and Japanese Keyboards.