Results 1 to 3 of 3

Thread: Automatically Make A Shortcut.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2009
    Location
    Scotland, UK
    Posts
    26

    Exclamation Automatically Make A Shortcut.

    Hi there. This will be a long post but please keep reading and please help me.

    What I have so far:

    I have a file explorer consisting of the Drive, Folder and File ListBox and a TextBox.

    The Drive, Folder and File ListBoxes make it easy to browse for files and the TextBox displays the selected files path.

    Code:
    Private Sub Dir1_Change()
    File1.Path = Dir1.Path
    End Sub
    
    Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
    End Sub
    
    Private Sub File1_Click()
    txtPath.Text = File1.Path & "\" & File1.FileName
    End Sub
    What i want to do next is when File1 is gets Double Clicked there is a shortcut (*.lnk) file automatically generated in the:

    Code:
    App.Path & "\" & File1.FileName
    I do not know the code to make the shortcut file. Hopefully someone does.

    Also i would like when the return key gets pressed within the File ListBox is the file gets opened by it's preffered application. e.g. File1.DOC gets opened with microsoft word and File1.FRM gets opened with Visual Basic. I do not know the code for this.


    Thanks in advanced.
    Alistair.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Automatically Make A Shortcut.

    For creating a shortcut, search our Codebank - VB6 forum. I'm pretty sure there have been good examples posted.

    For opening files in their default programs use ShellExecute - see the "Working with other programs" section of our Classic VB FAQs (in the FAQ forum) for an explanation and examples.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2009
    Location
    Scotland, UK
    Posts
    26

    Re: Automatically Make A Shortcut.

    Thanks si_the_geek. Great info.

Tags for this Thread

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