本帖最后由 the2008 于 2014-11-17 22:13 编辑
如何使用AU3在win7的任务栏里面创建软件(比如office2010)的快速启动图标?
晚上用谷歌搜索了一下,终于让我找到了,十分膜拜
这是代码引用的地址:
http://www.autoitscript.com/foru ... unch-for-windows-7/#include <WinAPI.au3>
#include <Constants.au3>
_PinTaskbar(@WindowsDir & '\notepad.exe')
Func _PinTaskbar($File, $Pin = True)
If @OSBuild < 7600 Then Return SetError(1) ; Windows 7 only
If Not FileExists($File) Then Return SetError(2)
local $sFolder = StringRegExpReplace($File, "(^.*\\)(.*)", "\1")
local $sFile = StringRegExpReplace($File, "^.*\", "")
local $oShell = ObjCreate("Shell.Application")
local $oFolder = $oShell.NameSpace($sFolder)
local $oFolderItem = $oFolder.ParseName($sFile)
local $oFolderItemVerbs = $oFolderItem.Verbs
local $hInstance = _WinAPI_LoadLibraryEx("shell32.dll", $LOAD_LIBRARY_AS_DATAFILE)
local $DoVerb = ''
If $hInstance Then
IF $Pin = 1 Then
local $DoVerb = _WinAPI_LoadString($hInstance, 5386)
Else
local $DoVerb = _WinAPI_LoadString($hInstance, 5387)
EndIf
_WinAPI_FreeLibrary($hInstance)
EndIf
IF $DoVerb = '' Then Return SetError(3) ; $DoVerb string couldn't received
For $i = 0 To $oFolderItemVerbs.Count - 1
If $oFolderItemVerbs.Item($i).Name = $DoVerb Then
$oFolderItemVerbs.Item($i).DoIt
Return
EndIf
Next
Return SetError(4) ; $DoVerb string not in menu
EndFunc
|