C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-19-2006, 03:06 PM   #1
Registered User
 
Join Date: Nov 2006
Posts: 6
Desktop Shortcut

I'm creating an installer and I can't find a good location on how to create an desktop shortcut. Any ideas or suggestions are appreciated.

Thanks,
Josh
Jster is offline   Reply With Quote
Old 12-20-2006, 09:38 AM   #2
Registered User
 
Join Date: Nov 2006
Posts: 6
Figured it out. By using the WIndows scripting object host as a reference and putting "using IWshRuntimeLibrary;", this function creates the desktop shortcut.

Code:
private void appShortcutToDesktop()
        {
            string shortcutFullName = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Name.lnk";
            WshShell shell = new WshShellClass();
            IWshShortcut link = (IWshShortcut)shell.CreateShortcut(shortcutFullName);
            link.TargetPath = "C:\\FOLDER\\EXECUTEME.exe";
            link.Description = "DESC OF WHOAH";
            link.Save();
        }
Jster is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extended Desktop Dimensions Jaken Veina Windows Programming 2 01-16-2009 09:15 AM
Getting Icons from the Desktop Mastadex Windows Programming 6 08-29-2007 04:33 PM
"Organizing" Your Desktop for Coding skim Windows Programming 2 03-13-2006 06:52 PM
Showing Desktop SW_DEFAULT Yuri Windows Programming 6 11-20-2005 01:28 PM
shortcut problem Micko Tech Board 3 09-17-2004 03:01 PM


All times are GMT -6. The time now is 02:58 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22