至于具体十六进制数代表什么功能,我在MSDN找到了答案。
(
http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx)
下面摘录一段:
VK_BROWSER_BACK (0xA6)
Windows 2000/XP: Browser Back key
VK_BROWSER_FORWARD (0xA7)
Windows 2000/XP: Browser Forward key
VK_BROWSER_REFRESH (0xA8)
Windows 2000/XP: Browser Refresh key
VK_BROWSER_STOP (0xA9)
Windows 2000/XP: Browser Stop key
VK_BROWSER_SEARCH (0xAA)
Windows 2000/XP: Browser Search key
VK_BROWSER_FAVORITES (0xAB)
Windows 2000/XP: Browser Favorites key
VK_BROWSER_HOME (0xAC)
Windows 2000/XP: Browser Start and Home key
VK_VOLUME_MUTE (0xAD)
Windows 2000/XP: Volume Mute key
VK_VOLUME_DOWN (0xAE)
Windows 2000/XP: Volume Down key
VK_VOLUME_UP (0xAF)
Windows 2000/XP: Volume Up key
VK_MEDIA_NEXT_TRACK (0xB0)
Windows 2000/XP: Next Track key
VK_MEDIA_PREV_TRACK (0xB1)
Windows 2000/XP: Previous Track key
VK_MEDIA_STOP (0xB2)
Windows 2000/XP: Stop Media key
VK_MEDIA_PLAY_PAUSE (0xB3)
Windows 2000/XP: Play/Pause Media key
VK_LAUNCH_MAIL (0xB4)
Windows 2000/XP: Start Mail key
VK_LAUNCH_MEDIA_SELECT (0xB5)
Windows 2000/XP: Select Media key
VK_LAUNCH_APP1 (0xB6)
Windows 2000/XP: Start Application 1 key
VK_LAUNCH_APP2 (0xB7)
Windows 2000/XP: Start Application 2 key
B6 Application 1 就是我的电脑
B7 Application 2 就是计算器
为了更方便的实现这些功能,我编了一段简单的vbs
a=chr(&h88b5)
'msgbox "d" & a & "d"
CreateObject("wscript.shell").Sendkeys a
简单的解释一下
a=chr(&h88b5)
'“&h”表示后面的数是十六进制数,b5代表Media key,也就是媒体播放器(比如千千静听),为什么前面要加88呢?加了88以后,有两个字节,也就构成了一个汉字(是GBK里的),因为a代表的字符若不是真正有意义的字符(比如ASCII字符和汉字),sendkeys就不会起作用,大家可以试一下。至于为什么选择88,因为在msdn里写着(0x88-8F)Unassigned,同时88为开头的字符可以组成有意义的GBK汉字。
'msgbox "d" & a & "d"
'可以测试a是不是有意义的字符
CreateObject("wscript.shell").Sendkeys a
'调用SendKeys方法。
Last edited by zsc37201 on 2010-8-2 at 19:38 ]
As for what specific hexadecimal numbers represent in terms of functions, I found the answer on MSDN.
(
http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx)
The following is an excerpt:
VK_BROWSER_BACK (0xA6)
Windows 2000/XP: Browser Back key
VK_BROWSER_FORWARD (0xA7)
Windows 2000/XP: Browser Forward key
VK_BROWSER_REFRESH (0xA8)
Windows 2000/XP: Browser Refresh key
VK_BROWSER_STOP (0xA9)
Windows 2000/XP: Browser Stop key
VK_BROWSER_SEARCH (0xAA)
Windows 2000/XP: Browser Search key
VK_BROWSER_FAVORITES (0xAB)
Windows 2000/XP: Browser Favorites key
VK_BROWSER_HOME (0xAC)
Windows 2000/XP: Browser Start and Home key
VK_VOLUME_MUTE (0xAD)
Windows 2000/XP: Volume Mute key
VK_VOLUME_DOWN (0xAE)
Windows 2000/XP: Volume Down key
VK_VOLUME_UP (0xAF)
Windows 2000/XP: Volume Up key
VK_MEDIA_NEXT_TRACK (0xB0)
Windows 2000/XP: Next Track key
VK_MEDIA_PREV_TRACK (0xB1)
Windows 2000/XP: Previous Track key
VK_MEDIA_STOP (0xB2)
Windows 2000/XP: Stop Media key
VK_MEDIA_PLAY_PAUSE (0xB3)
Windows 2000/XP: Play/Pause Media key
VK_LAUNCH_MAIL (0xB4)
Windows 2000/XP: Start Mail key
VK_LAUNCH_MEDIA_SELECT (0xB5)
Windows 2000/XP: Select Media key
VK_LAUNCH_APP1 (0xB6)
Windows 2000/XP: Start Application 1 key
VK_LAUNCH_APP2 (0xB7)
Windows 2000/XP: Start Application 2 key
B6 Application 1 is My Computer
B7 Application 2 is Calculator
In order to implement these functions more conveniently, I compiled a simple VBS
a=chr(&h88b5)
'msgbox "d" & a & "d"
CreateObject("wscript.shell").Sendkeys a
A simple explanation
a=chr(&h88b5)
' "&h" means the following number is a hexadecimal number, b5 represents Media key, that is, media player (such as千千静听). Why add 88 in front? After adding 88, there are two bytes, which form a Chinese character (in GBK). Because if the character represented by a is not a truly meaningful character (such as ASCII characters and Chinese characters), SendKeys will not work. You can try it. As for why 88 is chosen, because it is written in MSDN that (0x88-8F) Unassigned, and the characters starting with 88 can form meaningful GBK Chinese characters.
'msgbox "d" & a & "d"
' can test whether a is a meaningful character
CreateObject("wscript.shell").Sendkeys a
' call SendKeys method.
Last edited by zsc37201 on 2010-8-2 at 19:38 ]