Hello, if you were wondering how to create a shortcut for your application, here's a way to do it, using the IWshRuntimeLibrary.
First off, you need to add a reference to your application. You do this by right-clicking on the References menu item in the Solution Explorer. Select the Add Reference menu. From the Add Reference dialog, click the .COM tab and select the 'Windows Scripting Host Object Model' and click the 'Add' button.
After you have done that, just paste this code into your project, and voilá, you're done!.
vb.net Code:
Imports IWshRuntimeLibrary Public Sub CreateShortCutOnDesktop() Try Dim ShortCut As IWshRuntimeLibrary.IWshShortcut 'Shortcuts have a .lnk extension... ShortCut = CType(WshShell.CreateShortcut(My.Computer.FileSystem.SpecialDirectories.Desktop & _ "\MyAppName.lnk"), _ IWshRuntimeLibrary.IWshShortcut) 'Let's set the shortcut properties... With ShortCut .TargetPath = _ System.Reflection.Assembly.GetExecutingAssembly.Location() .WindowStyle = 1 .Description = "A description for the shortcut.." .WorkingDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop 'This next line gets the first icon from the executing application.. .IconLocation = _ System.Reflection.Assembly.GetExecutingAssembly.Location() & _ ", 0" .Save() 'And save the shortcut... End With Catch ex As System.Exception 'Do something End Try End Sub
I hope you have found this easy and helpful.
Cheers.




.
.
Reply With Quote