Results 1 to 6 of 6

Thread: Get shortcut path

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Get shortcut path

    When my app is installed it creates a shortcut (Start-->Programs-->MyApp). As users will install the app to different locations and on different drives, how can I get the path of the shortcut so i can then place another on the desktop?

    I can create a shortcut, I just need to be able to get the path of the shortcut created from the setup.

    Thanks.

  2. #2
    Frenzied Member dis1411's Avatar
    Join Date
    Mar 2001
    Posts
    1,048
    hmm why not place the shortcut using the installation prog?

    it should have the ability to find the desktop for u

  3. #3

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    The P&D wizard only gives you the option to create one at (Start-->Programs-->MyApp) and not on the desktop.

  4. #4
    Frenzied Member dis1411's Avatar
    Join Date
    Mar 2001
    Posts
    1,048
    what a POS, i personally use the visual studio .net P&D wizard to deploy my vb6 stuff.. anyway

    VB Code:
    1. Private Sub Command1_Click()
    2.     If Environ("userprofile") <> "" Then
    3.         MsgBox Environ("userprofile") & "\desktop"
    4.     Else
    5.         MsgBox Environ("windir") & "\desktop"
    6.     End If
    7. End Sub

  5. #5
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    N42 29.340 W71 53.215
    Posts
    422

    Try this

    Code:
    Public Function Get_Shortcut_TargetFile_Name( _
        Optional LinkFile As String) As String
    
        ' resolve a shortcut target
        ' needs reference to: "Windows Script Host Object Model" wshom.ocx
    
        ' Windows2000 fails at Set WS = New WshShell
        ' "Automation error. The specified procedure could not be found."
    
        Dim WS As WshShell
        Dim oShellLink As WshShortcut
    
        Set WS = New WshShell
        Set oShellLink = WS.CreateShortcut(LinkFile) 'all shortcuts end in .LNK
        Get_Shortcut_TargetFile_Name = oShellLink.TargetPath
        Set oShellLink = Nothing
        Set WS = Nothing
    
    End Function    ' Get_Shortcut_TargetFile_Name
    '################################################################################
    "The wise man doesn't know all the answers, but he knows where to find them."
    VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15

  6. #6
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171


    Has someone helped you? Then you can Rate their helpful post.

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