Results 1 to 3 of 3

Thread: Changing Target in Shortcut`s properties .

  1. #1
    Guest

    Talking



    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.

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    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
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3
    Guest

    Thanks!!!!

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