|
|
Retreives the target of a .lnk file, optionally including any arguments. If the passed string is not a link, the string which was passed is returned. This does not use the more common scripting method and therefore isn't prone to stops from antivirus, etc. This does not work in the following scenarios: This is unfortunate behavior, and if you have any information on workarounds to either of the issues outlined above, the sharing of that information would be greatly appreciated by the community. Enjoy! CODE ' GetLinkTarget ' http://www.utteraccess.com/wiki/index.php/GetLinkTarget ' Code courtesy of UtterAccess Wiki ' Licensed under Creative Commons License ' http://creativecommons.org/licenses/by-sa/3.0/ ' ' You are free to use this code in any application, ' provided this notice is left unchanged. ' ' rev date brief descripton ' 1.0 2011-09-29 ' Public Function GetLinkTarget(sLink As String, Optional bIncludeArguments As Boolean = True) As String On Error GoTo err_proc Dim Ret As String With CreateObject("Shell.Application").Namespace(0).ParseName(sLink).GetLink Ret = .Path If bIncludeArguments Then Ret = Trim(Ret & " " & .Arguments) End With exit_proc: GetLinkTarget = Ret Exit Function err_proc: If Err.Number = 91 Then Ret = sLink Resume exit_proc End Function
|
| This page was last modified 01:35, 30 September 2011. This page has been accessed 356 times. Disclaimers |