Solved

Creating a C# Installer Program with Visual Studio 2012

Posted on 2014-02-27
3
313 Views
Last Modified: 2014-04-26
Hello, I am creating an installer program for Visual Studio 2012.  The program on it's own is simple enough, all I am doing is creating 10 icons that link to 10 different websites and I need the links to all be collectively put into a folder which will be found from the Start menu.  To give an example, here is a sample of what I am talking about but the only difference is the icons and website that it is linking to would be different:

Folder - Business Stuff
    1. Microsoft Icon(shortcut link) - links to Microsoft.com
    2. Google Icon(shortcut link) - links to Google.com
    3. Apple Icon(shortcut link) - links to Apple.com
    4. Yahoo Icon (shortcut link) - links to Yahoo.com
    5. Twitter Icon (shortcut link) - links to Twitter.com
    6. Facebook Icon (shortcut link) - links to Facebook.com
    7. Cnn.com Icon (shortcut link) - links to Cnn.com
   8. Msnbc.com Icon (shortcut link) - links to MSNBC.com
   9. Wikipedia.com Icon (shortcut link) - links to Wikipedia.com
  10. Instagram.com Icon (shortcut link) - links to Instagram.com

Each shortcut link will obviously be an .lnk file and when the user opens the folder in the Start Menu called Business Stuff, it will display all of the above links one on top of the other.  When you click on the link, it goes to the appropriate website listed above.  How could I create something like this in Visual Studio 2012?  Thanks!
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 39893826
http://www.sorrowman.org/c-sharp-programmer/url-link-to-desktop.html
using System.IO;

private void urlShortcutToDesktop(string linkName, string linkUrl)
{
    string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

    using (StreamWriter writer = new StreamWriter(deskDir + "\\" + linkName + ".url"))
    {
        writer.WriteLine("[InternetShortcut]");
        writer.WriteLine("URL=" + linkUrl);
        writer.Flush();
    }
}

Open in new window


Now if you call it using something like this:

urlShortcutToDesktop("google link", "http://www.google.com/");

it should create shortcut in your desktop.
0
 

Author Comment

by:VBBRett
ID: 39908100
Thank you David, maybe if I could shed a little more light or detail on the subject.  I was told that the 10 programs above has to be consolidated into 1 program but I still need 10 icons.  So, as opposed to having this on the Desktop, it actually has to be in the Start Menu in a folder called "Business Services".  Inside the "Business Services" which is in the Start Menu, I would need all 10 icons to be available to be clicked on in this "Business Services" folder.  Each icon would be different and each icon would have to be linked to the appropriate sites above.  The program has to be able to be installed into Microsoft Windows using the Visual Studio InstallShield Wizard.  At the end of the game, this installshield program will be deployed to several desktop computers in the office.  Please tell me how I am to do this?  I have this as my code for one link, how could I have 10 links with a link for each icon?:

        static void Main(string[] args)
        {
           
            string target = "http://www.google.com";       
            
            
            try
            {
                
                System.Diagnostics.Process.Start(target);
            }
            catch (System.ComponentModel.Win32Exception noBrowser)
            {
                if (noBrowser.ErrorCode == -2147467259)
                    MessageBox.Show(noBrowser.Message);
            }
            catch (System.Exception other)
            {
                MessageBox.Show(other.Message);
            }                            

        }

Open in new window

0
 

Author Comment

by:VBBRett
ID: 39913725
How about this?

     public static void CreateShortcut(string shortcutname, string shortcutpath, string targetFileLocation)
        {
            string shortcutLocation = System.IO.Path.Combine(shortcutpath, shortcutname + ".lnk");
            WshShell shell = new WshShell();
            IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);

            shortcut.Description = "My shortcut Description";
            shortcut.IconLocation = "MSN-Icon.ico";
            shortcut.TargetPath = "http://www.msn.com";
            shortcut.Save();
            
        }

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question