We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 29,803 times

Related Categories

Create a shortcut

Kimmy

The following code provides an easy way to creating shortcuts (*.lnk files) using Visual Basic, by taking advantage of the STKIT432.DLL file. For code that does not require this file, click here.

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 to create the shortcut
'
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:\Winnt\system32\calc.exe", "")

Till the Roof comes off Till the Lights go out Till my Legs give out Can't shut my mouth I will not fall, my Wisdoms all.

Comments

  • Excellent code & i need ur help..

    Posted by Parthasarathy_1 on 06 Feb 2005

    Excellent code and its working fine...

    I need sample code for removing this shortcut also... i tried with visal basic file system object... but i shows file not found...Can you able to help me in ...

  • Posted by tsugantino on 09 May 2003

    That would be easier if I had been using the HTML side of a web form, however, all my code was done in the code behind. I wish I could've used the methods you described or I'd have to rewrite the who...

  • Posted by Kimmy on 09 May 2003

    i dont know why i keep getting replies from here since this is my first post

    but a much simpler way i discovered and put on my website http://members.aol.com/genxbot and goto 'code' section

    al...

  • Retrieving the target info from a shortcut

    Posted by tsugantino on 09 May 2003

    I finally found out how to retrieve the target info from a shortcut file in ASP.NET using the code behind in a web form. I'm sure this will work in VB.NET, too.

    First make a reference to 'Windows ...

  • retrieving the target info in shortcuts

    Posted by tsugantino on 06 May 2003

    Did you ever find out how to retrieve the target or url information from a shortcut?

    What I'm trying to do is if I have a shortcut to a web page (like something from the favorites folder), I'd like...