Start Menu Shortcut
Use this board to post your code snippets - tips and tricks
5 posts
Page 1 of 1
Hello,
This code will add a shortcut to your application onto the start menu:
Make a reference to the "Windows Script Host Object Model" COM library and then in your code add:
Change "NameOfFolder" to a folder name to store your shortcut into.
Change "C:\NameofIconToUseOnShortcut.ico" to the filename and location of an icon file you wish to display as your shortcut.
Happy coding cooll;
This code will add a shortcut to your application onto the start menu:
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
Dim MenuShortcut As WshShellClass = New WshShellClass
Dim NewShortcut As IWshRuntimeLibrary.IWshShortcut
Dim MyAppFolder = "NameOfFolder"
Dim MyIconFile = "C:\NameofIconToUseOnShortcut.ico"
Dim StartMenuFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Programs)
My.Computer.FileSystem.CreateDirectory(StartMenuFolder & "\" & MyAppFolder & "\")
NewShortcut = CType(MenuShortcut.CreateShortcut(StartMenuFolder & "\" & MyAppFolder & "\" & Application.ProductName & ".lnk"), IWshRuntimeLibrary.IWshShortcut)
NewShortcut.TargetPath = Application.ExecutablePath
NewShortcut.IconLocation = MyIconFile
NewShortcut.Save()
Change "NameOfFolder" to a folder name to store your shortcut into.
Change "C:\NameofIconToUseOnShortcut.ico" to the filename and location of an icon file you wish to display as your shortcut.
Happy coding cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
This is always nice to know...I will have to try this in one of my apps.
Cheers Codenstuff
as all with your codes, nice and easily laid out and very Handy
as all with your codes, nice and easily laid out and very Handy

Great Job CodenStuff I already tried your snippets for Desktop shortcut Icon and it works... wahooo;
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023