Results 1 to 2 of 2

Thread: change desktop icon target path?

  1. #1

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    change desktop icon target path?

    I have code in my app that deletes an existing icon and recreates it with a new target path. This is my code, it seems like over kill to me.

    Is it possible to just change the target paths file name instead of deleting it and then recreating it?


    VB Code:
    1. 'delete the flash shortcut
    2.     Dim shell As Object
    3.     Dim link As Object
    4.     Dim DesktopPath As String
    5.     Set shell = CreateObject("WScript.Shell")
    6.     DesktopPath = shell.SpecialFolders("AllUsersDesktop")
    7.     fso.DeleteFile DesktopPath & "\Agent Prospecting Presentation.lnk"
    8.  
    9.     'create a new flash shortcut
    10.     'because we are replacing the old exe
    11.     Set shell = CreateObject("WScript.Shell")
    12.     DesktopPath = shell.SpecialFolders("AllUsersDesktop")
    13.     Set link = shell.CreateShortcut(DesktopPath & "\Agent Prospecting Presentation.lnk")
    14.     'link.Arguments = "1 2 3"
    15.     link.Description = "Agent Prospecting Presentation"
    16.     'link.HotKey = "CTRL+ALT+SHIFT+X"
    17.     link.IconLocation = "C:\WestfieldInsurance\Westfield_1to1F_v1.exe,1"
    18.     link.TargetPath = "C:\MyWestfieldPresentation\Westfield_1to1F_v1.exe"
    19.     'window style 3=maximized, 2=normal
    20.     link.WindowStyle = 2
    21.     'start in
    22.     link.WorkingDirectory = "C:\MyWestfieldPresentation"
    23.     link.Save
    He who never made a mistake never made a discovery?

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: change desktop icon target path?

    See this code by RobDog888.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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