2
我發現這個代碼:VB.NET/C#代碼訪問鏈接(LNK)的目標路徑的文件會產生一些錯誤的路徑
Public Shared Function GetLnkTarget(ByVal lnkPath As String) As String
Dim shl = New Shell32.Shell()
' Move this to class scope
lnkPath = System.IO.Path.GetFullPath(lnkPath)
Dim dir = shl.[NameSpace](System.IO.Path.GetDirectoryName(lnkPath))
Dim itm = dir.Items().Item(System.IO.Path.GetFileName(lnkPath))
Dim lnk = DirectCast(itm.GetLink, Shell32.ShellLinkObject)
Return lnk.Target.Path
End Function
它適用於一些.LNK文件,但例如,如果我加我它產生的Skype.exe桌面鏈接:
C:\Windows\Installer\{...}\SkypeIcon.exe
是否有修復?
嗯,看起來很像你實際上使用GetIconLocation()方法。 – 2012-02-26 18:14:56
在這種情況下對我的問題意味着什麼?不知道它是如何解釋爲什麼它適用於某些鏈接,但不適用於其他鏈接(例如,它不適用於我的桌面上的Skype鏈接) – user670186 2012-02-27 23:41:15