:) Hi all , I need to get Api functions to be able to read and write shortcuts directly to the place I want . if there any Scripting solution it'll be fine .
hoping to get answer as fast as any one can.
Thanks to you all.:wave:
Printable View
:) Hi all , I need to get Api functions to be able to read and write shortcuts directly to the place I want . if there any Scripting solution it'll be fine .
hoping to get answer as fast as any one can.
Thanks to you all.:wave:
This api for create & delete shortcut example source code:
Code:Private Declare Function OSfCreateShellGroup Lib "Vb5stkit.dll" Alias "fCreateShellFolder" (ByVal lpstrDirName As String) As Long
Private Declare Function OSfCreateShellLink Lib "Vb5stkit.dll" Alias "fCreateShellLink" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArguments As String) As Long
Private Declare Function OSfRemoveShellLink Lib "Vb5stkit.dll" Alias "fRemoveShellLink" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String) As Long
Dim lresult As Long
Private Sub CmdAdd1_Click()
Dim lresult As Long
lresult = OSfCreateShellGroup("Test")
End Sub
Private Sub CmdDel_Click()
Dim lresult As Long
lresult = OSfRemoveShellLink("..\..\start menu", "Notepad")
lresult = OSfRemoveShellLink("..\..\desktop", "Notepad")
lresult = OSfRemoveShellLink("Test", "Notepad")
End Sub
Private Sub CmdAdd2_Click()
Dim lresult As Long
lresult = OSfCreateShellLink("..\..\desktop", "Notepad", "c:\Windows\notepad.exe", "")
End Sub
Private Sub CmdAdd4_Click()
lresult = OSfCreateShellLink("test", "Notepad", "c:\Windows\notepad.exe", "")
End Sub
Private Sub CmdAdd3_Click()
lresult = OSfCreateShellLink("..\..\start menu", "Notepad", "c:\Windows\notepad.exe", "")
End Sub
thanks too much for responding ... but for sorry the "Vb5stkit.dll" library not exist , I'm working at vb6 under operating system XP . and I used this modified function at XP and almost worked .
Public Declare Function fCreateShellLink Lib "vb6stkit.DLL" ( _
ByVal lpstrFolderName As String, _
ByVal lpstrLinkName As String, _
ByVal lpstrLinkPath As String, _
ByVal lpstrLinkArgs As String, _
ByVal fPrivate As Long, _
ByVal sParent As String) As Long
My proplem with this function that it creates only one shortcut and I must reboot my Own program to work again .
I also modified your OSfRemoveShellLink to Vb6stkit.dll and received no error but it didn't work(i don't know why).
I also need to know how to Read Shortcuts contents like (Target path - Icon - comment - parameter) , I hope to find an answer.
many thanks for efforts.
Try: http://www.thescarms.com/vbasic/shelllnk.aspx (does just about everything)
Nice link schoolbusdriver :thumb:
Many thanks to you all for help and support.