Results 1 to 4 of 4

Thread: Shortcut

  1. #1
    Guest

    Talking

    How do you create shortcut for a application in VB6 code????? Thanks!

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Here are codes to make a short cut in "C:" drive or you can change the destination to the Desktop. Also, it shows you how to make a shortcut to the internet.

    Code:
    Option Explicit
    
    'NOTE:
    'In Visual Basic 5.0 & 6.0 = Vb5stkit.dll
    'In Visual Basic 4.0       = Stkit432.dll
    
    Private Declare Function fCreateShellLink Lib "Vb5STKIT.dll" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long
    
    Private Sub cmdRegular_Shortcut_Click()
      'PURPOSE: Add to Startup Group
      'Note that on Windows NT, the shortcut will not actually
      'appear in the Startup group until your next reboot.
      Call fCreateShellLink("\Startup", "Shortcut to Calculator", "c:\windows\calc.exe", "")
      MsgBox "Shortcut of calculator has resided in \Startup"
      
      'PURPOSE: Add to Desktop
      'Call fCreateShellLink("..\..\Desktop", "Shortcut to Calculator", "c:\windows\calc.exe", "")
      
      'PURPOSE: Add to Program Menu Group
      'Call fCreateShellLink("", "Shortcut to Calculator", "c:\windows\calc.exe", "")
    End Sub
    
    Private Sub cmdInternet_Shortcut_Click()
      Dim str_Shortcut_Name As String
      Dim str_URL As String
      str_Shortcut_Name = "C:\Shortcut Name.url"
      str_URL = "URL= http://www.yahoo.com"
    
      'PURPOSE: Write the Internet Shortcut file
      Open str_Shortcut_Name For Output As #1
      Print #1, "[InternetShortcut]"
      Print #1, str_URL
      Close #1
    
      MsgBox "Internet shortcut has resided in C:\"
    End Sub
    Chemically Formulated As:
    Dr. Nitro

  3. #3
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    From Developer Code Book
    Code:
    'Declarations
    'NOTE: In Visual Basic 5.0, change Stkit432.dll in the following
    'statement to Vb5stkit.dll. Stkit432.dll is for Visual Basic 4.0
    
    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
    
    
    'Code:
    Dim lReturn As Long
    
    'Add to Desktop
    lReturn = fCreateShellLink("..\..\Desktop", _
    "Shortcut to Calculator", "c:\windows\calc.exe", "")
    
    'Add to Program Menu Group
    lReturn = fCreateShellLink("", "Shortcut to Calculator", _
    "c:\windows\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:\windows\calc.exe", "")
    hth

  4. #4
    Guest
    Originally posted by QWERTY
    From Developer Code Book
    Code:
    'Declarations
    'NOTE: In Visual Basic 5.0, change Stkit432.dll in the following
    'statement to Vb5stkit.dll. Stkit432.dll is for Visual Basic 4.0
    
    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
    
    
    'Code:
    Dim lReturn As Long
    
    'Add to Desktop
    lReturn = fCreateShellLink("..\..\Desktop", _
    "Shortcut to Calculator", "c:\windows\calc.exe", "")
    
    'Add to Program Menu Group
    lReturn = fCreateShellLink("", "Shortcut to Calculator", _
    "c:\windows\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:\windows\calc.exe", "")
    hth
    Thanks! But where can I get the STKIT432.DLL file? VB couldn't find the file.

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