Virtual-Key Codes

October 6, 2025 · View on GitHub

The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.

ConstantValueDescription
VK_LBUTTON0x01Left mouse button
VK_RBUTTON0x02Right mouse button
VK_CANCEL0x03Control-break processing
VK_MBUTTON0x04Middle mouse button
VK_XBUTTON10x05X1 mouse button
VK_XBUTTON20x06X2 mouse button
0x07Reserved
VK_BACK0x08Backspace key
VK_TAB0x09Tab key
0x0A-0BReserved
VK_CLEAR0x0CClear key
VK_RETURN0x0DEnter key
0x0E-0FUnassigned
VK_SHIFT0x10Shift key
VK_CONTROL0x11Ctrl key
VK_MENU0x12Alt key
VK_PAUSE0x13Pause key
VK_CAPITAL0x14Caps lock key
VK_KANA0x15IME Kana mode
VK_HANGUL0x15IME Hangul mode
VK_IME_ON0x16IME On
VK_JUNJA0x17IME Junja mode
VK_FINAL0x18IME final mode
VK_HANJA0x19IME Hanja mode
VK_KANJI0x19IME Kanji mode
VK_IME_OFF0x1AIME Off
VK_ESCAPE0x1BEsc key
VK_CONVERT0x1CIME convert
VK_NONCONVERT0x1DIME nonconvert
VK_ACCEPT0x1EIME accept
VK_MODECHANGE0x1FIME mode change request
VK_SPACE0x20Spacebar key
VK_PRIOR0x21Page up key
VK_NEXT0x22Page down key
VK_END0x23End key
VK_HOME0x24Home key
VK_LEFT0x25Left arrow key
VK_UP0x26Up arrow key
VK_RIGHT0x27Right arrow key
VK_DOWN0x28Down arrow key
VK_SELECT0x29Select key
VK_PRINT0x2APrint key
VK_EXECUTE0x2BExecute key
VK_SNAPSHOT0x2CPrint screen key
VK_INSERT0x2DInsert key
VK_DELETE0x2EDelete key
VK_HELP0x2FHelp key
00x300 key
10x311 key
20x322 key
30x333 key
40x344 key
50x355 key
60x366 key
70x377 key
80x388 key
90x399 key
0x3A-40Undefined
A0x41A key
B0x42B key
C0x43C key
D0x44D key
E0x45E key
F0x46F key
G0x47G key
H0x48H key
I0x49I key
J0x4AJ key
K0x4BK key
L0x4CL key
M0x4DM key
N0x4EN key
O0x4FO key
P0x50P key
Q0x51Q key
R0x52R key
S0x53S key
T0x54T key
U0x55U key
V0x56V key
W0x57W key
X0x58X key
Y0x59Y key
Z0x5AZ key
VK_LWIN0x5BLeft Windows logo key
VK_RWIN0x5CRight Windows logo key
VK_APPS0x5DApplication key
0x5EReserved
VK_SLEEP0x5FComputer Sleep key
VK_NUMPAD00x60Numeric keypad 0 key
VK_NUMPAD10x61Numeric keypad 1 key
VK_NUMPAD20x62Numeric keypad 2 key
VK_NUMPAD30x63Numeric keypad 3 key
VK_NUMPAD40x64Numeric keypad 4 key
VK_NUMPAD50x65Numeric keypad 5 key
VK_NUMPAD60x66Numeric keypad 6 key
VK_NUMPAD70x67Numeric keypad 7 key
VK_NUMPAD80x68Numeric keypad 8 key
VK_NUMPAD90x69Numeric keypad 9 key
VK_MULTIPLY0x6AMultiply key
VK_ADD0x6BAdd key
VK_SEPARATOR0x6CSeparator key
VK_SUBTRACT0x6DSubtract key
VK_DECIMAL0x6EDecimal key
VK_DIVIDE0x6FDivide key
VK_F10x70F1 key
VK_F20x71F2 key
VK_F30x72F3 key
VK_F40x73F4 key
VK_F50x74F5 key
VK_F60x75F6 key
VK_F70x76F7 key
VK_F80x77F8 key
VK_F90x78F9 key
VK_F100x79F10 key
VK_F110x7AF11 key
VK_F120x7BF12 key
VK_F130x7CF13 key
VK_F140x7DF14 key
VK_F150x7EF15 key
VK_F160x7FF16 key
VK_F170x80F17 key
VK_F180x81F18 key
VK_F190x82F19 key
VK_F200x83F20 key
VK_F210x84F21 key
VK_F220x85F22 key
VK_F230x86F23 key
VK_F240x87F24 key
0x88-8FReserved
VK_NUMLOCK0x90Num lock key
VK_SCROLL0x91Scroll lock key
0x92-96OEM specific
0x97-9FUnassigned
VK_LSHIFT0xA0Left Shift key
VK_RSHIFT0xA1Right Shift key
VK_LCONTROL0xA2Left Ctrl key
VK_RCONTROL0xA3Right Ctrl key
VK_LMENU0xA4Left Alt key
VK_RMENU0xA5Right Alt key
VK_BROWSER_BACK0xA6Browser Back key
VK_BROWSER_FORWARD0xA7Browser Forward key
VK_BROWSER_REFRESH0xA8Browser Refresh key
VK_BROWSER_STOP0xA9Browser Stop key
VK_BROWSER_SEARCH0xAABrowser Search key
VK_BROWSER_FAVORITES0xABBrowser Favorites key
VK_BROWSER_HOME0xACBrowser Start and Home key
VK_VOLUME_MUTE0xADVolume Mute key
VK_VOLUME_DOWN0xAEVolume Down key
VK_VOLUME_UP0xAFVolume Up key
VK_MEDIA_NEXT_TRACK0xB0Next Track key
VK_MEDIA_PREV_TRACK0xB1Previous Track key
VK_MEDIA_STOP0xB2Stop Media key
VK_MEDIA_PLAY_PAUSE0xB3Play/Pause Media key
VK_LAUNCH_MAIL0xB4Start Mail key
VK_LAUNCH_MEDIA_SELECT0xB5Select Media key
VK_LAUNCH_APP10xB6Start Application 1 key
VK_LAUNCH_APP20xB7Start Application 2 key
0xB8-B9Reserved
VK_OEM_10xBAIt can vary by keyboard. For the US ANSI keyboard , the Semiсolon and Colon key
VK_OEM_PLUS0xBBFor any country/region, the Equals and Plus key
VK_OEM_COMMA0xBCFor any country/region, the Comma and Less Than key
VK_OEM_MINUS0xBDFor any country/region, the Dash and Underscore key
VK_OEM_PERIOD0xBEFor any country/region, the Period and Greater Than key
VK_OEM_20xBFIt can vary by keyboard. For the US ANSI keyboard, the Forward Slash and Question Mark key
VK_OEM_30xC0It can vary by keyboard. For the US ANSI keyboard, the Grave Accent and Tilde key
0xC1-C2Reserved
VK_GAMEPAD_A0xC3Gamepad A button
VK_GAMEPAD_B0xC4Gamepad B button
VK_GAMEPAD_X0xC5Gamepad X button
VK_GAMEPAD_Y0xC6Gamepad Y button
VK_GAMEPAD_RIGHT_SHOULDER0xC7Gamepad Right Shoulder button
VK_GAMEPAD_LEFT_SHOULDER0xC8Gamepad Left Shoulder button
VK_GAMEPAD_LEFT_TRIGGER0xC9Gamepad Left Trigger button
VK_GAMEPAD_RIGHT_TRIGGER0xCAGamepad Right Trigger button
VK_GAMEPAD_DPAD_UP0xCBGamepad D-pad Up button
VK_GAMEPAD_DPAD_DOWN0xCCGamepad D-pad Down button
VK_GAMEPAD_DPAD_LEFT0xCDGamepad D-pad Left button
VK_GAMEPAD_DPAD_RIGHT0xCEGamepad D-pad Right button
VK_GAMEPAD_MENU0xCFGamepad Menu/Start button
VK_GAMEPAD_VIEW0xD0Gamepad View/Back button
VK_GAMEPAD_LEFT_THUMBSTICK_BUTTON0xD1Gamepad Left Thumbstick button
VK_GAMEPAD_RIGHT_THUMBSTICK_BUTTON0xD2Gamepad Right Thumbstick button
VK_GAMEPAD_LEFT_THUMBSTICK_UP0xD3Gamepad Left Thumbstick up
VK_GAMEPAD_LEFT_THUMBSTICK_DOWN0xD4Gamepad Left Thumbstick down
VK_GAMEPAD_LEFT_THUMBSTICK_RIGHT0xD5Gamepad Left Thumbstick right
VK_GAMEPAD_LEFT_THUMBSTICK_LEFT0xD6Gamepad Left Thumbstick left
VK_GAMEPAD_RIGHT_THUMBSTICK_UP0xD7Gamepad Right Thumbstick up
VK_GAMEPAD_RIGHT_THUMBSTICK_DOWN0xD8Gamepad Right Thumbstick down
VK_GAMEPAD_RIGHT_THUMBSTICK_RIGHT0xD9Gamepad Right Thumbstick right
VK_GAMEPAD_RIGHT_THUMBSTICK_LEFT0xDAGamepad Right Thumbstick left
VK_OEM_40xDBIt can vary by keyboard. For the US ANSI keyboard, the Left Brace key
VK_OEM_50xDCIt can vary by keyboard. For the US ANSI keyboard, the Backslash and Pipe key
VK_OEM_60xDDIt can vary by keyboard. For the US ANSI keyboard, the Right Brace key
VK_OEM_70xDEIt can vary by keyboard. For the US ANSI keyboard, the Apostrophe and Double Quotation Mark key
VK_OEM_80xDFIt can vary by keyboard. For the Canadian CSA keyboard, the Right Ctrl key
0xE0Reserved
0xE1OEM specific
VK_OEM_1020xE2It can vary by keyboard. For the European ISO keyboard, the Backslash and Pipe key
0xE3-E4OEM specific
VK_PROCESSKEY0xE5IME PROCESS key
0xE6OEM specific
VK_PACKET0xE7Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
0xE8Unassigned
0xE9-F5OEM specific
VK_ATTN0xF6Attn key
VK_CRSEL0xF7CrSel key
VK_EXSEL0xF8ExSel key
VK_EREOF0xF9Erase EOF key
VK_PLAY0xFAPlay key
VK_ZOOM0xFBZoom key
VK_NONAME0xFCReserved
VK_PA10xFDPA1 key
VK_OEM_CLEAR0xFEClear key

Remarks

Do not rely on the K_LWIN (0x5B) + VK_F17 (0x80) keys to permanently switch a setting. At shutdown, the system uses these keys to reset various settings, which could include those set by your app.

Requirements

RequirementValue
Minimum supported clientWindows 2000 Professional [desktop apps only]
Minimum supported serverWindows 2000 Server [desktop apps only]
HeaderWinuser.h