雨夜 发表于 2010-10-17 03:25:40

VB6读取快捷方式的三项

请问如何用VB6读取快捷方式的"目标"、"图标"以及 快捷方式的名称 等三项内容?

马大哈 发表于 2010-10-17 13:12:56

与创建快捷方式一样的开头.

不过传入的路径是已存在的lnk文件,这样就会取得这个对象.

然后可以查询它的各个属性了.

Public Sub GetLnk(ByVal FilePath As String)
Dim WshShell As Object, oShellLink As Object, strDesktop As String

Set WshShell = CreateObject("WScript.Shell")

strDesktop = WshShell.SpecialFolders("Desktop") '桌面路径
Set oShellLink = WshShell.CreateShortcut(FilePath)

Debug.Print oShellLink.TargetPath
Debug.Print oShellLink.Arguments
Debug.Print oShellLink.WindowStyle '风格
Debug.Print oShellLink.Hotkey '热键

Debug.Print oShellLink.IconLocation

Debug.Print oShellLink.Description '快捷方式备注内容
Debug.Print oShellLink.WorkingDirectory '源文件所在目录

Set WshShell = Nothing
Set oShellLink = Nothing
End Sub

zmh886 发表于 2010-10-18 02:50:27

不错- -
页: [1]
查看完整版本: VB6读取快捷方式的三项