找回密码
 加入
搜索
查看: 3322|回复: 6

[AU3基础] (已解决)如何使用AU3在win7的任务栏里面创建软件的快捷图标

[复制链接]
发表于 2014-11-17 17:22:41 | 显示全部楼层 |阅读模式
本帖最后由 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

评分

参与人数 1金钱 +30 收起 理由
nmgwddj + 30 这个一定得给分,我今天就研究这个东西,看 ...

查看全部评分

发表于 2014-11-17 17:28:25 | 显示全部楼层
我也很想了解这个。
发表于 2017-3-3 11:47:36 | 显示全部楼层
那如何解除任务栏上的快捷方式呢?
发表于 2017-3-3 13:18:43 | 显示全部楼层
先看看学习一下!
发表于 2017-3-15 11:09:18 | 显示全部楼层
不错,学习了。
发表于 2017-10-13 14:20:47 | 显示全部楼层
不错,学习了。
发表于 2017-12-5 10:58:29 | 显示全部楼层
不知道WIN8.1和WIN10能不能用
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-28 17:14 , Processed in 0.080873 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表