Results 1 to 6 of 6

Thread: [RESOLVED] How to Read and Write Shortcuts

  1. #1

    Thread Starter
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241

    Resolved [RESOLVED] How to Read and Write Shortcuts

    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.

  2. #2
    Addicted Member cxj98's Avatar
    Join Date
    Feb 2007
    Posts
    170

    Re: How to Read and Write Shortcuts

    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

  3. #3

    Thread Starter
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241

    Re: How to Read and Write Shortcuts

    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.

  4. #4
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: How to Read and Write Shortcuts

    Try: http://www.thescarms.com/vbasic/shelllnk.aspx (does just about everything)

  5. #5
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: How to Read and Write Shortcuts

    Nice link schoolbusdriver
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  6. #6

    Thread Starter
    Addicted Member Ashraf Alshahawy's Avatar
    Join Date
    May 2007
    Location
    Egypt
    Posts
    241

    Re: How to Read and Write Shortcuts

    Many thanks to you all for help and support.
    Some times when you make a step forward ...You can't get back. Be sure where you make your steps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width