VB6读取快捷方式的三项
请问如何用VB6读取快捷方式的"目标"、"图标"以及 快捷方式的名称 等三项内容? 与创建快捷方式一样的开头.不过传入的路径是已存在的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 不错- -
页:
[1]