0
Reply

Create URL shortcut on Client desktop

my devel

my devel

Sep 17 2010 12:16 PM
4.9k
Hi there,
do you know how can i create shortcut with my desire picture on client desktop, currently I can create a shortcut on the desktop when the visitor click on the Button but it's created by the default icon, not my icon.
I google it and found this code, but as i mentioned it does not create my picture.

Thanks in advanced

using IWshRuntimeLibrary;

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();
        }
    }

protected void Button1_Click(object sender, EventArgs e)
    {
        urlShortcutToDesktop("Shortcut_Name", "http://www.yourdomian.com");
    }