Creating Desktop Shortcuts?

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts Page 1 of 1
Contributors
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 445
Joined: Tue Feb 16, 2010 6:24 am

Creating Desktop Shortcuts?
Livengood
Can someone help me out and explain how to create desktop short cuts in Vb.Net
if would be very helpful to my program that i am making :D wahooo;
Last edited by Livengood on Thu Mar 04, 2010 11:36 pm, edited 1 time in total.
Image
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Re: Creating Desktop Shortcuts?
Nery
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 445
Joined: Tue Feb 16, 2010 6:24 am

Re: Creating Desktop Shortcuts?
Livengood
i think thats done in C++....
i have tried google found nothing that worked :(
Image
User avatar
tedhead2
Excellent Poster
Excellent Poster
Posts: 338
Joined: Sun Jan 03, 2010 8:36 am

Re: Creating Desktop Shortcuts?
tedhead2
I can do that in VB, just convert the code, plus it;s NOT C++, it;s C#. Learn to tell the differance.
Image
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Creating Desktop Shortcuts?
CodenStuff
Hello,

Make a reference to the "Windows Script Host Object Model" COM library and then in your code add:
Code: Select all
Imports IWshRuntimeLibrary
Then when you want to create the shortcut, like in a "Form_Load" or "Button_Click" or something use:
Code: Select all
Dim NewShell As WshShellClass = New WshShellClass
        Dim DeskTopShortCut As IWshRuntimeLibrary.IWshShortcut
        Dim DesktopFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
        DeskTopShortCut = CType(NewShell.CreateShortcut(DesktopFolder & "\NameOfShortCut.lnk"), IWshRuntimeLibrary.IWshShortcut)
        DeskTopShortCut.TargetPath = Application.ExecutablePath
        DeskTopShortCut.Save()
Change "NameOfShortCut.lnk" to the whatever you want to call the shortcut filename.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 445
Joined: Tue Feb 16, 2010 6:24 am

Re: Creating Desktop Shortcuts?
Livengood
o i see, i wasnt really sure if it was C++ or C#
i just need to find out how to do that, i have made a pro. installer program.... i am going to release the code when i am done :D
Image
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: Creating Desktop Shortcuts?
AleRi8
thanks for the shortcut code ;)
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
7 posts Page 1 of 1
Return to “Tutorial Requests”