更改快捷方式指向图标

qxboy 2008-05-13 09:51:00
我用"vb6stkit.DLL"的fCreateShellLink函数建立快捷方式,但想更改快捷方式的指向图标为另一个应用程序的图标,不知道该如何实现
...全文
440 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qxboy 2008-05-14
  • 打赏
  • 举报
回复
谢谢各位,我先试一下,我用微软自己的那个SHELLLNK,好像快捷方式图标不会自已涮新的,点属性确定以后就可以用了。
嗷嗷叫的老马 2008-05-13
  • 打赏
  • 举报
回复
我来抢5分:)

发一个不用引用对象的代码,动态调用的.

Public Sub mShellLnk(ByVal LnkName As String, IconFileIconIndex As String, ByVal FilePath As String, Optional ByVal FileName As String, Optional ByVal StrArg As String, Optional ByVal HookKey As String = "", Optional ByVal StrRemark As String = "", Optional ByVal strDesktop As String = "")
Dim WshShell As Object, WScript As Object, oShellLink As Object

Set WshShell = CreateObject("WScript.Shell")
If strDesktop = "" Then strDesktop = WshShell.SpecialFolders("Desktop") '桌面路径
If UCase(Right(LnkName, 4)) = ".LNK" Then
Set oShellLink = WshShell.CreateShortcut(strDesktop & "\" & LnkName) '创建快捷方式,参数为路径和名称
Else
Set oShellLink = WshShell.CreateShortcut(strDesktop & "\" & LnkName & ".lnk")
End If
oShellLink.TargetPath = FilePath & "\" & FileName
oShellLink.Arguments = StrArg
oShellLink.WindowStyle = 1 '风格
oShellLink.Hotkey = HookKey '热键
oShellLink.IconLocation = IconFileIconIndex '图标
oShellLink.Description = StrRemark '快捷方式备注内容
oShellLink.WorkingDirectory = FilePath '源文件所在目录
oShellLink.Save '保存创建的快捷方式
Set WshShell = Nothing
Set oShellLink = Nothing
End Sub


测试的话,调用:

mShellLnk "TestLnk","mspaint.exe","C:\windows\","notepad.exe"

看看桌面,图标是啥..
东方之珠 2008-05-13
  • 打赏
  • 举报
回复
参见我写的,里面12楼:
http://topic.csdn.net/u/20080328/15/9152a78b-05b4-4c04-810d-15ad59408d33.html?1983084767

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧