虚拟键值表
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1 01 VK_LBUTTON 滑鼠左键
2 02 VK_RBUTTON 滑鼠右键
3 03 VK_CANCEL ˇ Ctrl-Break
4 04 VK_MBUTTON 滑鼠中键
您永远都不会从键盘讯息中获得这些滑鼠键代码。在下一章可以看到,我们能够从滑鼠讯息中获得它们。VK_CANCEL代码是一个虚拟键码,它包括同时按下两个键(Ctrl-Break)。Windows应用程式通常不使用此键。
表6-3中的键--Backspace、Tab、Enter、Escape和Spacebar-通常用於Windows程式。不过,Windows一般用字元讯息(而不是键盘讯息)来处理这些键。
表6-3
十进位 十六进位 WINUSER.H识别字 必需? IBM相容键盘
8 08 VK_BACK ˇ Backspace
9 09 VK_TAB ˇ Tab
12 0C VK_CLEAR Num Lock关闭时的数字键盘5
13 0D VK_RETURN ˇ Enter (或者另一个)
16 10 VK_SHIFT ˇ Shift (或者另一个)
17 11 VK_CONTROL ˇ Ctrl (或者另一个)
18 12 VK_MENU ˇ Alt (或者另一个)
19 13 VK_PAUSE Pause
20 14 VK_CAPITAL ˇ Caps Lock
27 1B VK_ESCAPE ˇ Esc
32 20 VK_SPACE ˇ Spacebar
另外,Windows程式通常不需要监视Shift、Ctrl或Alt键的状态。
表6-4列出的前八个码可能是与VK_INSERT和VK_DELETE一起最常用的虚拟键码:
表6-4
十进位 十六进位 WINUSER.H识别字 必需? IBM相容键盘
33 21 VK_PRIOR ˇ Page Up
34 22 VK_NEXT ˇ Page Down
35 23 VK_END ˇ End
36 24 VK_HOME ˇ Home
37 25 VK_LEFT ˇ 左箭头
38 26 VK_UP ˇ 上箭头
39 27 VK_RIGHT ˇ 右箭头
40 28 VK_DOWN ˇ 下箭头
41 29 VK_SELECT
42 2A VK_PRINT
43 2B VK_EXECUTE
44 2C VK_SNAPSHOT Print Screen
45 2D VK_INSERT ˇ Insert
46 2E VK_DELETE ˇ Delete
47 2F VK_HELP
注意,许多名称(例如VK_PRIOR和VK_NEXT)都与键上的标志不同,而且也与卷动列中的识别字不统一。Print Screen键在平时都被Windows应用程式所忽略。Windows本身回应此键时会将视讯显示的点阵图影本存放到剪贴板中。假使有键盘提供了VK_SELECT、VK_PRINT、VK_EXECUTE和VK_HELP,大概也没几个人看过那样的键盘。
Windows也包括在主键盘上的字母和数位键的虚拟键码(数字键盘将单独处理)。
表6-5
十进位 十六进位 WINUSER.H识别字 必需? IBM相容键盘
48-57 30-39 无 ˇ 主键盘上的0到9
65-90 41-5A 无 ˇ A到Z
注意,数字和字母的虚拟键码是ASCII码。Windows程式几乎从不使用这些虚拟键码;实际上,程式使用的是ASCII码字元的字元讯息。
表6-6所示的代码是由Microsoft Natural Keyboard及其相容键盘产生的:
表6-6
十进位 十六进位 WINUSER.H识别字 必需? IBM相容键盘
91 5B VK_LWIN 左Windows键
92 5C VK_RWIN 右W
indows键
93 5D VK_APPS Applications键
Windows用VK_LWIN和VK_RWIN键打开「开始」功能表或者(在以前的版本中)启动「工作管理员程式」。这两个都可以用於登录或登出Windows(只在Microsoft Windows NT中有效),或者登录或登出网路(在Windows for Applications中)。应用程式能够通过显示辅助资讯或者当成捷径键看待来处理application键。
表6-7所示的代码用於数字键盘上的键(如果有的话):
表6-7
十进位 十六进位 WINUSER.H识别字 必需? IBM相容键盘
96-105 60-69 VK_NUMPAD0到VK_ NUMPAD9 NumLock打开时数字键盘上的0到9
106 6A VK_MULTIPLY 数字键盘上的*
107 6B VK_ADD 数字键盘上的+
108 6C VK_SEPARATOR
109 6D VK_SUBTRACT 数字键盘上的-
110 6E VK_DECIMAL 数字键盘上的.
111 6F VK_DIVIDE 数字键盘上的/
最後,虽然多数的键盘都有12个功能键,但Windows只需要10个,而位元旗标却有24个。另外,程式通常用功能键作为键盘加速键,这样,它们通常不处理表6-8所示的按键:
表6-8
十进位 十六进位 WINUSER.H识别字 必需? IBM相容键盘
112-121 70-79 VK_F1到VK_F10 ˇ 功能键F1到F10
122-135 7A-87 VK_F11到VK_F24 功能键F11到F24
144 90 VK_NUMLOCK Num Lock
145 91 VK_SCROLL Scroll Lock
另外,还定义了一些其他虚拟键码,但它们只用於非标准键盘上的键,或者通常在大型主机终端机上使用的键。查看/ Platform SDK / User Interface Services / User Input / Virtual-Key Codes,可得到完整的列表。
虚拟键表
虚拟键与ASCII码对应的有: '1'-'9','A'-'Z'
vkkeyscan()函数可查看相应字符的实数值.参数为字符;
API常量型 实数值 解释
VK_LBUTTON 1 滑鼠左键
VK_RBUTTON 2 滑鼠右键
VK_CANCEL 3 Ctrl+Break
VK_MBUTTON 4 滑鼠中键
VK_BACK 8 退格
VK_TAB 9 TAB
VK_CLEAR 12 NUM LOCK关闭时的数字键盘5?
VK_RETURN 13 回车
VK_SHIFT 16 Shift
VK_CONTROL 17 Ctrl
VK_MENU 18 Alt
VK_PAUSE 19 Pause Break
VK_CAPITAL 20 Caps Lock
VK_ESCAPE 27 ESC
VK_SPACE 32 空格键
VK_PRIOR 33 Page up
VK_NEXT 34 Page down
VK_END 35 End
VK_HOME 36 Home
VK_LEFT 37 左箭头
VK_RIGHT 38 上箭头
VK_UP 39 右箭头
VK_DOWN 40 下箭头
VK_SELECT 41
VK_PRINT 42
VK_EXECUTE 43
VK_SNAPSHOT 44 Print Screen
VK_INSERT 45 Insert
VK_DELETE 46 Delete
VK_HELP 47
VK_0..9 48..57 主键盘0..9
VK_A..Z 65..90 主键盘A..Z
VK_LWIN 91 左Win
VK_RWIN 92 右Win
VK_APPS 93 快捷菜单
Reserved 94 保留
VK_SLEEP 95 Sleep???
数字键盘
VK_NUMPAD0..9 96..105 小键盘上的0
到9
VK_MULTIPLY 106 小键盘上的*
VK_ADD 107 小键盘上的+
VK_SEPARATOR 108 分隔符
VK_SUBTRACT 109 小键盘上的-
VK_DECIMAL 110 小键盘上的.
VK_DIVIDE 111 小键盘上的/
VK_NUMLOCK 144 Num Lock
VK_F1..VK_F24 112..135 F1..24
Unassigned 136..145 未定义
VK_SCROLL 145 Scroll Lock
Specific 146..150 特殊用途
Unassigned 151..159 未定义
VK_LSHIFT 160 左Shift键
VK_RSHIFT 161 右Shift键
VK_LCONTROL 162 左Ctrl键
VK_RCONTROL 163 右Ctrl键
VK_LMENU 164 左Alt键
VK_RMENU 165 右Alt键
浏览器
VK_BROWSER_BACK A6(166) Browser Back key
VK_BROWSER_FORWARD A7(167) Browser Forward key
VK_BROWSER_REFRESH A8(168) Browser Refresh key
VK_BROWSER_STOP A9(169) Browser Stop key
VK_BROWSER_SEARCH AA(170) Browser Search key
VK_BROWSER_FAVORITES AB(171) Browser Favorites key
VK_BROWSER_HOME AC(172) Browser Start and Home key
音量
VK_VOLUME_MUTE AD Volume Mute key
VK_VOLUME_DOWN AE Volume Down key
VK_VOLUME_UP AF Volume Up key
媒体
VK_MEDIA_NEXT_TRACK B0 Next Track key
VK_MEDIA_PREV_TRACK B1 Previous Track key
VK_MEDIA_STOP B2 Stop Media key
VK_MEDIA_PLAY_PAUSE B3 Play/Pause Media key
语言
VK_LAUNCH_MAIL B4 Start Mail key
VK_LAUNCH_MEDIA_SELECT B5 Select Media key
VK_LAUNCH_APP1 B6 Start Application 1 key
VK_LAUNCH_APP2 B7 Start Application 2 key
标点
VK_OEM_1 186 分号
VK_OEM_PLUS 187 等号
VK_OEM_COMMA 188 逗号
VK_OEM_MINUS 189 减号
VK_OEM_PERIOD 190 句号
VK_OEM_2 191 /
VK_OEM_3 192 ~
Reserved 193..215 保留码
Unassined 216..218 未指定
VK_OEM_4 219 [
VK_OEM_5 220 \
VK_OEM_6 221 ]
VK_OEM_7 222 引号
VK_OEM_8 223
VK_ATTN HF6(246)
VK_CRSEL HF7(247)
VK_EXSEL HF8(248)
VK_EREOF HF9(249)
VK_PLAY HFA(250)
VK_ZOOM HFB(251)
VK_NONAME HFC(252)
VK_PA1 HFD(253)
VK_OEM_CLEAR HFE(254)
完整的虚拟键码表
VK_LBUTTON (01)
Left mouse button
VK_RBUTTON (02)
Right mouse button
VK_CANCEL (03)
Control-break processing
VK_MBUTTON (04)
Middle mouse button (three-button mouse)
VK_XBUTTON1 (05)
Windows 2000/XP: X1 mouse button
VK_XBUTTON2 (06)
Windows 2000/XP: X2 mouse button
- (07)
Undefined
VK_BACK (08)
BACKSPACE key
VK_TAB (09)
TAB key
- (0A-0B)
Reserved
VK_CLEAR (0C)
CLEAR key
VK_RETURN (0D)
ENTER key
- (0E-0F)
Undefined
VK_SHIFT (10)
SHIFT key
VK_CONTROL (11)
CTRL key
VK_MENU (12)
ALT key
VK_PAUSE (13)
PAUSE key
VK_CAPITAL (14)
CAPS LO
CK key
VK_KANA (15)
Input Method Editor (IME) Kana mode
VK_HANGUEL (15)
IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
VK_HANGUL (15)
IME Hangul mode
- (16)
Undefined
VK_JUNJA (17)
IME Junja mode
VK_FINAL (18)
IME final mode
VK_HANJA (19)
IME Hanja mode
VK_KANJI (19)
IME Kanji mode
- (1A)
Undefined
VK_ESCAPE (1B)
ESC key
VK_CONVERT (1C)
IME convert
VK_NONCONVERT (1D)
IME nonconvert
VK_ACCEPT (1E)
IME accept
VK_MODECHANGE (1F)
IME mode change request
VK_SPACE (20)
SPACEBAR
VK_PRIOR (21)
PAGE UP key
VK_NEXT (22)
PAGE DOWN key
VK_END (23)
END key
VK_HOME (24)
HOME key
VK_LEFT (25)
LEFT ARROW key
VK_UP (26)
UP ARROW key
VK_RIGHT (27)
RIGHT ARROW key
VK_DOWN (28)
DOWN ARROW key
VK_SELECT (29)
SELECT key
VK_PRINT (2A)
PRINT key
VK_EXECUTE (2B)
EXECUTE key
VK_SNAPSHOT (2C)
PRINT SCREEN key
VK_INSERT (2D)
INS key
VK_DELETE (2E)
DEL key
VK_HELP (2F)
HELP key
(30)
0 key
(31)
1 key
(32)
2 key
(33)
3 key
(34)
4 key
(35)
5 key
(36)
6 key
(37)
7 key
(38)
8 key
(39)
9 key
- (3A-40)
Undefined
(41)
A key
(42)
B key
(43)
C key
(44)
D key
(45)
E key
(46)
F key
(47)
G key
(48)
H key
(49)
I key
(4A)
J key
(4B)
K key
(4C)
L key
(4D)
M key
(4E)
N key
(4F)
O key
(50)
P key
(51)
Q key
(52)
R key
(53)
S key
(54)
T key
(55)
U key
(56)
V key
(57)
W key
(58)
X key
(59)
Y key
(5A)
Z key
VK_LWIN (5B)
Left Windows key (Microsoft Natural keyboard)
VK_RWIN (5C)
Right Windows key (Natural keyboard)
VK_APPS (5D)
Applications key (Natural keyboard)
- (5E)
Reserved
VK_SLEEP (5F)
Computer Sleep key
VK_NUMPAD0 (60)
Numeric keypad 0 key
VK_NUMPAD1 (61)
Numeric keypad 1 key
VK_NUMPAD2 (62)
Numeric keypad 2 key
VK_NUMPAD3 (63)
Numeric keypad 3 key
VK_NUMPAD4 (64)
Numeric keypad 4 key
VK_NUMPAD5 (65)
Numeric keypad 5 key
VK_NUMPAD6 (66)
Numeric keypad 6 key
VK_NUMPAD7 (67)
Numeric keypad 7 key
VK_NUMPAD8 (68)
Numeric keypad 8 key
VK_NUMPAD9 (69)
Nu
meric keypad 9 key
VK_MULTIPLY (6A)
Multiply key
VK_ADD (6B)
Add key
VK_SEPARATOR (6C)
Separator key
VK_SUBTRACT (6D)
Subtract key
VK_DECIMAL (6E)
Decimal key
VK_DIVIDE (6F)
Divide key
VK_F1 (70)
F1 key
VK_F2 (71)
F2 key
VK_F3 (72)
F3 key
VK_F4 (73)
F4 key
VK_F5 (74)
F5 key
VK_F6 (75)
F6 key
VK_F7 (76)
F7 key
VK_F8 (77)
F8 key
VK_F9 (78)
F9 key
VK_F10 (79)
F10 key
VK_F11 (7A)
F11 key
VK_F12 (7B)
F12 key
VK_F13 (7C)
F13 key
VK_F14 (7D)
F14 key
VK_F15 (7E)
F15 key
VK_F16 (7F)
F16 key
VK_F17 (80H)
F17 key
VK_F18 (81H)
F18 key
VK_F19 (82H)
F19 key
VK_F20 (83H)
F20 key
VK_F21 (84H)
F21 key
VK_F22 (85H)
F22 key
VK_F23 (86H)
F23 key
VK_F24 (87H)
F24 key
- (88-8F)
Unassigned
VK_NUMLOCK (90)
NUM LOCK key
VK_SCROLL (91)
SCROLL LOCK key
(92-96)
OEM specific
- (97-9F)
Unassigned
VK_LSHIFT (A0)
Left SHIFT key
VK_RSHIFT (A1)
Right SHIFT key
VK_LCONTROL (A2)
Left CONTROL key
VK_RCONTROL (A3)
Right CONTROL key
VK_LMENU (A4)
Left MENU key
VK_RMENU (A5)
Right MENU key
VK_BROWSER_BACK (A6)
Windows 2000/XP: Browser Back key
VK_BROWSER_FORWARD (A7)
Windows 2000/XP: Browser Forward key
VK_BROWSER_REFRESH (A8)
Windows 2000/XP: Browser Refresh key
VK_BROWSER_STOP (A9)
Windows 2000/XP: Browser Stop key
VK_BROWSER_SEARCH (AA)
Windows 2000/XP: Browser Search key
VK_BROWSER_FAVORITES (AB)
Windows 2000/XP: Browser Favorites key
VK_BROWSER_HOME (AC)
Windows 2000/XP: Browser Start and Home key
VK_VOLUME_MUTE (AD)
Windows 2000/XP: Volume Mute key
VK_VOLUME_DOWN (AE)
Windows 2000/XP: Volume Down key
VK_VOLUME_UP (AF)
Windows 2000/XP: Volume Up key
VK_MEDIA_NEXT_TRACK (B0)
Windows 2000/XP: Next Track key
VK_MEDIA_PREV_TRACK (B1)
Windows 2000/XP: Previous Track key
VK_MEDIA_STOP (B2)
Windows 2000/XP: Stop Media key
VK_MEDIA_PLAY_PAUSE (B3)
Windows 2000/XP: Play/Pause Media key
VK_LAUNCH_MAIL (B4)
Windows 2000/XP: Start Mail key
VK_LAUNCH_MEDIA_SELECT (B5)
Windows 2000/XP: Select Media key
VK_LAUNCH_APP1 (B6)
Windows 2000/XP: Start Application 1 key
VK_LAUNCH_APP2 (B7)
Windows 2000/XP: Start Application 2 key
- (B8-B9)
Reserved
VK_OEM_1 (BA)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard
keyboard, the ';:' key
VK_OEM_PLUS (BB)
Windows 2000/XP: For any country/region, the '+' key
VK_OEM_COMMA (BC)
Windows 2000/XP: For any country/region, the ',' key
VK_OEM_MINUS (BD)
Windows 2000/XP: For any country/region, the '-' key
VK_OEM_PERIOD (BE)
Windows 2000/XP: For any country/region, the '.' key
VK_OEM_2 (BF)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '/?' key
VK_OEM_3 (C0)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '`~' key
- (C1-D7)
Reserved
- (D8-DA)
Unassigned
VK_OEM_4 (DB)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '[{' key
VK_OEM_5 (DC)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the '\|' key
VK_OEM_6 (DD)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the ']}' key
VK_OEM_7 (DE)
Used for miscellaneous characters; it can vary by keyboard.
Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
VK_OEM_8 (DF)
Used for miscellaneous characters; it can vary by keyboard.
- (E0)