Hi All,
I am looking for a way to create an shortcut that points to a program located on a local server. I am able to do this through code using this:
//----------------------------------------------------------------------------//
// Place Shortcuts Inside Start Menu and On Desktop // //----------------------------------------------------------------------------// string DesktopPath = @"C:\Documents and Settings\All Users\Desktop\Shortcut.lnk"; string StartMenuPath = @"C:\Documents and Settings\All Users\Start Menu\Programs\Program\Shortcut.lnk";WshShell =
new WshShellClass(); // Create the shortcutIWshRuntimeLibrary.
IWshShortcut DesktopShortcut, StartMenuShortcut; // Choose the path for the shortcutDesktopShortcut = (IWshRuntimeLibrary.
IWshShortcut)WshShell.CreateShortcut(DesktopPath);StartMenuShortcut = (IWshRuntimeLibrary.
IWshShortcut)WshShell.CreateShortcut(StartMenuPath); // Where the shortcut should point toDesktopShortcut.TargetPath =
@"\\Server\Program\Program.exe";StartMenuShortcut.TargetPath =
@"\\Server\Program\Program.exe"; // Description for the shortcutDesktopShortcut.Description =
"Program Version";StartMenuShortcut.Description =
"Program Version"; // Specify location of shortcut's iconDesktopShortcut.IconLocation =
@"\\Server\Program\Icon.ico";StartMenuShortcut.IconLocation =
@"\\Server\Program\Icon.ico"; // Create the shortcut at the given pathDesktopShortcut.Save();
System.IO.
Directory.CreateDirectory(@"C:\Documents and Settings\All Users\Start Menu\Programs\Program\");StartMenuShortcut.Save();
...but I am looking for a way to have the installer automatically create these shortcuts. Similarly to how you can create shortcuts to .exe located inside your project. I am using Visual Studio 2005. Is this possible If so it would allow me to avoid some Custom Actions, which would be nice.
Thanks in advance.