Ceating Shortcuts through code in VB

How do I create shortcuts to .exe through code
LVL 1
sac666Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

inprasCommented:
Hi sac666
See which one suits U
http://www.thescarms.com/VBasic/ShellLnk.htm
or
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.


Or
http://www.thescarms.com/VBasic/Shortcuts.htm

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.