Press "Enter" to skip to content

virtual-key-codes

虚拟键编码映射表

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.

Constant/valueDescription
VK_LBUTTON0x01Left mouse button
VK_RBUTTON0x02Right mouse button
VK_CANCEL0x03Control-break processing
VK_MBUTTON0x04Middle mouse button (three-button mouse)
VK_XBUTTON10x05X1 mouse button
VK_XBUTTON20x06X2 mouse button
0x07Undefined
VK_BACK0x08BACKSPACE key
VK_TAB0x09TAB key
0x0A-0BReserved
VK_CLEAR0x0CCLEAR key
VK_RETURN0x0DENTER key
0x0E-0FUndefined
VK_SHIFT0x10SHIFT key
VK_CONTROL0x11CTRL key
VK_MENU0x12ALT key
VK_PAUSE0x13PAUSE key
VK_CAPITAL0x14CAPS LOCK key
VK_KANA0x15IME Kana mode
VK_HANGUEL0x15IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
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
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_INSERT0x2DINS key
VK_DELETE0x2EDEL key
VK_HELP0x2FHELP key
0x300 key
0x311 key
0x322 key
0x333 key
0x344 key
0x355 key
0x366 key
0x377 key
0x388 key
0x399 key
0x3A-40Undefined
0x41A key
0x42B key
0x43C key
0x44D key
0x45E key
0x46F key
0x47G key
0x48H key
0x49I key
0x4AJ key
0x4BK key
0x4CL key
0x4DM key
0x4EN key
0x4FO key
0x50P key
0x51Q key
0x52R key
0x53S key
0x54T key
0x55U key
0x56V key
0x57W key
0x58X key
0x59Y key
0x5AZ key
VK_LWIN0x5BLeft Windows key (Natural keyboard)
VK_RWIN0x5CRight Windows key (Natural keyboard)
VK_APPS0x5DApplications key (Natural keyboard)
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-8FUnassigned
VK_NUMLOCK0x90NUM LOCK key
VK_SCROLL0x91SCROLL LOCK key
0x92-96OEM specific
0x97-9FUnassigned
VK_LSHIFT0xA0Left SHIFT key
VK_RSHIFT0xA1Right SHIFT key
VK_LCONTROL0xA2Left CONTROL key
VK_RCONTROL0xA3Right CONTROL key
VK_LMENU0xA4Left MENU key
VK_RMENU0xA5Right MENU 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_10xBAUsed for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘;:’ key
VK_OEM_PLUS0xBBFor any country/region, the ‘+’ key
VK_OEM_COMMA0xBCFor any country/region, the ‘,’ key
VK_OEM_MINUS0xBDFor any country/region, the ‘-‘ key
VK_OEM_PERIOD0xBEFor any country/region, the ‘.’ key
VK_OEM_20xBFUsed for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘/?’ key
VK_OEM_30xC0Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘`~’ key
0xC1-D7Reserved
0xD8-DAUnassigned
VK_OEM_40xDBUsed for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘[{‘ key
VK_OEM_50xDCUsed for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘\|’ key
VK_OEM_60xDDUsed for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘]}’ key
VK_OEM_70xDEUsed for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the ‘single-quote/double-quote’ key
VK_OEM_80xDFUsed for miscellaneous characters; it can vary by keyboard.
0xE0Reserved
0xE1OEM specific
VK_OEM_1020xE2Either the angle bracket key or the backslash key on the RT 102-key keyboard
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 KEYBDINPUTSendInputWM_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
参考资料:https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注