#define KEY_F1 59
#define KEY_F2 60
#define KEY_F3 61
#define KEY_F4 62
#define KEY_F5 63
#define KEY_F6 64
#define KEY_F7 65
#define KEY_F8 66
#define KEY_F9 67
#define KEY_F10 68
#define KEY_INSERT 82
#define KEY_HOME 71
#define KEY_PAGEUP 73
#define KEY_PAGEDOWN 81
#define KEY_DEL 83
#define KEY_END 79
#define KEY_DASH 12
#define KEY_EQUAL 13
#define KEY_LBRACKET 26
#define KEY_RBRACKET 27
#define KEY_SEMICOLON 39
#define KEY_RQUOTE 40
#define KEY_LQUOTE 41
#define KEY_PERIOD 52
#define KEY_COMMA 51
#define KEY_SLASH 53
#define KEY_BACKSLASH 43
#define KEY_ENTER 28
#define KEY_BACKSPACE 14
#define KEY_SPACE 57
#define KEY_TAB 15
#define KEY_ESC 1
#define KEY_Q 16
#define KEY_W 17
#define KEY_E 18
#define KEY_R 19
#define KEY_T 20
#define KEY_Y 21
#define KEY_U 22
#define KEY_I 23
#define KEY_O 24
#define KEY_P 25
#define KEY_A 30
#define KEY_S 31
#define KEY_D 32
#define KEY_F 33
#define KEY_G 34
#define KEY_H 35
#define KEY_J 36
#define KEY_K 37
#define KEY_L 38
#define KEY_Z 44
#define KEY_X 45
#define KEY_C 46
#define KEY_V 47
#define KEY_B 48
#define KEY_N 49
#define KEY_M 50
#define KEY_1 2
#define KEY_2 3
#define KEY_3 4
#define KEY_4 5
#define KEY_5 6
#define KEY_6 7
#define KEY_7 8
#define KEY_8 9
#define KEY_9 10
#define KEY_0 11
/+++++++++++++++++++++++++CTR+各键扫描码+++++++++++++++++++++++++/
#define KEY_F1 0x5E
#define KEY_F2 0x5F
#define KEY_F3 0x60
#define KEY_F4 0x61
#define KEY_F5 0x62
#define KEY_F6 0x63
#define KEY_F7 0x64
#define KEY_F8 0x65
#define KEY_F9 0x66
#define KEY_F10 0x67
#define KEY_2 0x03
#define KEY_6 0x1E
#define KEY_Q 0x11
#define KEY_W 0x17
#define KEY_E 0x05
#define KEY_R 0x12
#define KEY_T 0x14
#define KEY_Y 0x19
#define KEY_U 0x15
#define KEY_I 0x09
#define KEY_O 0x0F
#define KEY_P 0x10
#define KEY_LBRACKET 0x1B
#define KEY_RBRACKET 0x1D
#define KEY_A 0x01
#define KEY_S 0x13
#define KEY_D 0x04
#define KEY_F 0x06
#define KEY_G 0x07
#define KEY_H 0x08
#define KEY_J 0x0A
#define KEY_K 0x0B
#define KEY_L 0x0C
#define KEY_Z 0x1A
#define KEY_X 0x18
#define KEY_C 0x03
#define KEY_V 0x16
#define KEY_B 0x02
#define KEY_N 0x0E
#define KEY_M 0x0D
#define KEY_SPACE 0x20
#define KEY_BACKSPACE 0x7F
#define KEY_ENTER 0x0A
#define KEY_BACKSLASH 0x1C
#define KEY_L1 0x75
#define KEY_L3 0x76
#define KEY_L4 0x73
#define KEY_L6 0x74
#define KEY_L7 0x77
#define KEY_L9 0x84
/+++++++++++++++++++++++++SHIFT+各键扫描码+++++++++++++++++++++++++/
#define KEY_LQUOTE 0x7E
#define KEY_1 0x21
#define KEY_2 0x40
#define KEY_3 0x23
#define KEY_4 0x24
#define KEY_5 0x25
#define KEY_6 0x5E
#define KEY_7 0x26
#define KEY_8 0x2A
#define KEY_9 0x28
#define KEY_0 0x29
#define KEY_DASH 0x5F
#define KEY_EQUAL 0x2B
#define KEY_BACKSPACE 0x08
#define KEY_Q 0x51
#define KEY_W 0x57
#define KEY_E 0x45
#define KEY_R 0x52
#define KEY_T 0x54
#define KEY_Y 0x59
#define KEY_U 0x55
#define KEY_I 0x49
#define KEY_O 0x4F
#define KEY_P 0x50
#define KEY_LBRACKET 0x7B
#define KEY_RBRACKET 0x7D
#define KEY_ENTER 0x0D
#define KEY_A 0x41
#define KEY_S 0x53
#define KEY_D 0x44
#define KEY_F 0x46
#define KEY_G 0x47
#define KEY_H 0x48
#define KEY_J 0x4A
==================================================================================================
键盘键与虚拟键码对照表
字母和数字键 数字小键盘的键 功能键 其它键
键 键码 键 键码 键 键码 键 键码
A 65 0 96 F1 112 Backspace 8
B 66 1 97 F2 113 Tab 9
C 67 2 98 F3 114 Clear 12
D 68 3 99 F4 115 Enter 13
E 69 4 100 F5 116 Shift 16
F 70 5 101 F6 117 Control 17
G 71 6 102 F7 118 Alt 18
H 72 7 103 F8 119 Caps Lock 20
I 73 8 104 F9 120 Esc 27
J 74 9 105 F10 121 Spacebar 32
K 75 * 106 F11 122 Page Up 33
L 76 + 107 F12 123 Page Down 34
M 77 Enter 108 -- -- End 35
N 78 - 109 -- -- Home 36
O 79 . 110 -- -- Left Arrow 37
P 80 / 111 -- -- Up Arrow 38
Q 81 -- -- -- -- Right Arrow 39
R 82 -- -- -- -- Down Arrow 40
S 83 -- -- -- -- Insert 45
T 84 -- -- -- -- Delete 46
U 85 -- -- -- -- Help 47
V 86 -- -- -- -- Num Lock 144
W 87
X 88
Y 89
Z 90
0 48
1 49
2 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
0x1 鼠标左键
0x2 鼠标右键
0x3 CANCEL 键
0x4 鼠标中键
0x8 BACKSPACE 键
0x9 TAB 键
0xC CLEAR 键
0xD ENTER 键
0x10 SHIFT 键
0x11 CTRL 键
0x12 MENU 键
0x13 PAUSE 键
0x14 CAPS LOCK 键
0x1B ESC 键
0x20 SPACEBAR 键
0x21 PAGE UP 键
0x22 PAGE DOWN 键
0x23 END 键
0x24 HOME 键
0x25 LEFT ARROW 键
0x26 UP ARROW 键
0x27 RIGHT ARROW 键
0x28 DOWN ARROW 键
0x29 Select 键
0x2A PRINT SCREEN 键
0x2B EXECUTE 键
0x2C SNAPSHOT 键
0x2D Insert 键
0x2E Delete 键
0x2F HELP 键
0x90 NUM LOCK 键
A 至 Z 键与 A – Z 字母的 ASCII 码相同:
值 描述
65 A 键
66 B 键
67 C 键
68 D 键
69 E 键
70 F 键
71 G 键
72 H 键
73 I 键
74 J 键
75 K 键
76 L 键
77 M 键
78 N 键
79 O 键
80 P 键
81 Q 键
82 R 键
83 S 键
84 T 键
85 U 键
86 V 键
87 W 键
88 X 键
89 Y 键
90 Z 键
0 至 9 键与数字 0 – 9 的 ASCII 码相同:
值 描述
48 0 键
49 1 键
50 2 键
51 3 键
52 4 键
53 5 键
54 6 键
55 7 键
56 8 键
57 9 键
下列常数代表数字键盘上的键:
值 描述
0x60 0 键
0x61 1 键
0x62 2 键
0x63 3 键
0x64 4 键
0x65 5 键
0x66 6 键
0x67 7 键
0x68 8 键
0x69 9 键
0x6A MULTIPLICATION SIGN (*) 键
0x6B PLUS SIGN (+) 键
0x6C ENTER 键
0x6D MINUS SIGN (–) 键
0x6E DECIMAL POINT (.) 键
0x6F DIVISION SIGN (/) 键
下列常数代表功能键:
值 描述
0x70 F1 键
0x71 F2 键
0x72 F3 键
0x73 F4 键
0x74 F5 键
0x75 F6 键
0x76 F7 键
0x77 F8 键
0x78 F9 键
0x79 F10 键
0x7A F11 键
0x7B F12 键
0x7C F13 键
0x7D F14 键
0x7E F15 键
0x7F F16 键
0 None
3 Cancel(Break)
8 Back
9 Tab
13 Return
16 ShiftKey
17 ControlKey
18 Menu
19 Pause
20 Capital(大小写)
27 Escape
32 Space
33 PageUp
34 Next(PageDonw)
35 End
36 Home
37 Left
38 Up
39 Right
40 Down
0-9 48-57
45 Insert
46 Delete
65->90 A->Z
91 LWin
93 Apps
96 105 NumPad0-
106 Multiply *
107 Add+
108
109 Subtract-
110 Decimal .
111 Divide /
112-123 F1-F12
144 NumLock
145 Scroll
173 VolumeMute
174 VolumeDown
175 VolumeUp
186 Oem1 ;
187 Oemplus =
188 Oemcomma ,
189 OemMinus -
190 OemPeriod .
191 OemQuestion /
192 Oemtilde `
219 OemOpenBrackets [
220 Oem5 \
221 Oem6 ]
222 Oem7 '