Get Target Path Of Shortcut
VB Code:
Option Explicit
Private Sub Command1_Click()
MsgBox GetTargetPath("ShortCut Filename")
End Sub
Function GetTargetPath(ByVal FileName As String)
Dim Obj As Object
Set Obj = CreateObject("WScript.Shell")
Dim Shortcut As Object
Set Shortcut = Obj.CreateShortcut(FileName)
GetTargetPath = Shortcut.TargetPath
Shortcut.Save
End Function
Re: Get Target Path Of Shortcut
2 problems with the above:
1. Not sure which file, but installing McAfee deletes some file and
Set Obj = CreateObject("WScript.Shell")
never works!.
2. McAfee detects this as a scritpting going on and prompts for allowing it.
Is there any other way?
Re: Get Target Path Of Shortcut
Have a look at RobDog888's code here : http://www.vbforums.com/showthread.php?t=322799
It might work, I don't know...
Re: Get Target Path Of Shortcut
I didnt check it further but it also uses shell technique.
Scripting etc is "caught" by McAfee \Norton etc and it is a point of concern because home users trust anti-virus programs more than my program :mad:
May be some workaround to find the short-cut target not using shell or scripting.
Re: Get Target Path Of Shortcut
Actually my code example uses the Shell32.dll This is different from Windows Scripting Host.
Re: Get Target Path Of Shortcut
1 more problem.
If there are 2 operating system, say windows 98 on C drive and windows XP on drive D, then checking the shortcuts created with Windows XP and not properly handled in our application running on say Windows 98.
I do this:
1. Run the application in windows 98.
2. Try to open the shortcut created in Windows XP.
3. The path returned is always C:\ something. Actually it should be D:\ something
Re: Get Target Path Of Shortcut
i am trying to do the same exact thing in c++ can anyone help with this? please thank you,.
Re: Get Target Path Of Shortcut
This worked great for me. Thank you ever so much, manavo11!