-
Dear Friends,
I just wanna know how to change the target in a shortcut's properties, so that instead of pointing at "C:\abc.exe", it can point to "c:\xyz.exe"; by using VB.
And how to search for the shortcut that actually pointing at a particular program, because the user might rename the shortcut, so it cant be traced by its name, so anyway to trace it ??
Thanks ..
Darren.
-
From your Visual studio setup CDs there is a demo project for shortcuts.
This is located at:
CD3\COMMON\TOOLS\VB\UNSUPPRT\SHELLLNK
Email me if you don't have access to this!
Otherwise the following API could be used for creating new ones, once the old has been removed:
fCreastShell
Code:
Option Explicit
'NOTE: In Visual Basic 5.0, change Stkit432.dll in the following
'statement to Vb5stkit.dll.
Private Declare Function fCreateShellLink Lib "STKIT432.DLL" (ByVal _
lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal _
lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long
Sub Command1_Click()
Dim lReturn As Long
'Add to Desktop
lReturn = fCreateShellLink("..\..\Desktop", _
"Shortcut to Calculator", "c:\Winnt\system32\calc.exe", "")
'Add to Program Menu Group
lReturn = fCreateShellLink("", "Shortcut to Calculator", _
"c:\Winnt\system32\calc.exe", "")
'Add to Startup Group
'Note that on Windows NT, the shortcut will not actually appear
'in the Startup group until your next reboot.
lReturn = fCreateShellLink("\Startup", "Shortcut to Calculator", _
"c:\Winnt\system32\calc.exe", "")
End Sub
(code extract from MSDN libray)
Hope this helps;)
-