|
-
Dec 18th, 2003, 01:37 PM
#1
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
Has someone helped you? Then you can Rate their helpful post. 
-
Jun 27th, 2005, 06:45 AM
#2
Addicted Member
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?
-
Jun 27th, 2005, 09:42 AM
#3
-
Jun 28th, 2005, 12:51 AM
#4
Addicted Member
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
May be some workaround to find the short-cut target not using shell or scripting.
-
Jun 28th, 2005, 02:28 PM
#5
Re: Get Target Path Of Shortcut
Actually my code example uses the Shell32.dll This is different from Windows Scripting Host.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 17th, 2005, 02:11 AM
#6
Addicted Member
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
-
Apr 7th, 2008, 01:33 PM
#7
New Member
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,.
-
Sep 14th, 2011, 12:37 AM
#8
Lively Member
Re: Get Target Path Of Shortcut
This worked great for me. Thank you ever so much, manavo11!
Anyone who does not wonder, is either omnipotent or a fool.
Amerigoware <<<My Projects
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|