Desktop Shortcut
Use this board to post your code snippets - tips and tricks
4 posts
Page 1 of 1
Hello,
This code will add a shortcut for your application on the users desktop:
Make a reference to the "Windows Script Host Object Model" COM library and then in your code add:
Thats all you have to do, no need to change anymore code cooll;
This code will add a shortcut for your application on the users desktop:
Make a reference to the "Windows Script Host Object Model" COM library and then in your code add:
Code: Select all
Then when you want to create your shortcut:Imports IWshRuntimeLibrary
Code: Select all
Change "C:\NameofIconToUseOnShortcut.ico" to the filename and location of an icon file you wish to display as your shortcut. Dim DesktopShortcut As WshShellClass = New WshShellClass
Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut
Dim MyIconFile = "C:\NameofIconToUseOnShortcut.ico"
Dim Desktop As String = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
MyShortcut = CType(DesktopShortcut.CreateShortcut(Desktop & "\" & Application.ProductName & ".lnk"), IWshRuntimeLibrary.IWshShortcut)
MyShortcut.TargetPath = Application.ExecutablePath
MyShortcut.IconLocation = MyIconFile
MyShortcut.Save()
Thats all you have to do, no need to change anymore code cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
This is great..I was wondering if there was a way to do this or not.
CnS goes b1g in Shortcuts
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023