【问题标题】:How to create an internet shortcut with an icon in c#?如何在 C# 中创建带有图标的 Internet 快捷方式?
【发布时间】:2012-10-06 00:46:31
【问题描述】:

我想在桌面上创建一个带有自定义图标的 Internet 快捷方式(url 文件)。要创建快捷方式,我目前使用:

    private void CreateShortcut(string name, string url)
    {
        string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

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

但是这段代码没有设置自定义图标。如何设置图标?

【问题讨论】:

    标签: c# wpf icons shortcut


    【解决方案1】:

    设置IconIndexIconFile参数:

    [InternetShortcut]
    URL=<url>
    IconIndex=0
    IconFile=<path to custom icon icon file>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-22
      • 1970-01-01
      • 2019-02-24
      相关资源
      最近更新 更多