Results 1 to 2 of 2

Thread: how to create shorcut in vb?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    42
    how to create shorcut in vb?

  2. #2
    New Member
    Join Date
    May 2000
    Posts
    5

    Thumbs up Here You Go

    Steps for Creating a Shell Link (Shortcut) to the Desktop
    Start a new project in Visual Basic. Form1 is created by default.


    Add a Command button (Command1) to Form1.


    Add the following code to the General Declarations section of Form1:


    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

    Press the F5 key to run the project, and then click the Command button.

    Cheers

    Hope This Helps

    Dan.

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