桌面上的Internet快捷方式Windows 7不显示图标 [英] Icon not displaying for internet shortcut windows 7 on desktop

查看:204
本文介绍了桌面上的Internet快捷方式Windows 7不显示图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码创建Internet快捷方式。但是在桌面的情况下,我正在设置的快捷方式的图标未显示。但是,如果我手动将快捷方式重命名为其他名称,它将正常工作(图标将作为快捷方式图像加载。)

I am creating Internet shortcut using the following code. But the icon of the shortcut which I am setting is not getting displayed in the case of desktop. But if I am manually renaming the shortcut to some other name its working fine(icon is getting loaded as shortcut image).

private String CreateDeskTopShortcut(String ApplicationStartupUrl, String IconFilePath)
{
    string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
    String UrlPath = deskDir + "\\" + "Test" + ".url";

    using (StreamWriter writer = new StreamWriter(UrlPath))
    {
        writer.WriteLine("[InternetShortcut]");
        writer.WriteLine("URL=" + ApplicationStartupUrl);
        writer.WriteLine("IconFile=" + IconFilePath);
        writer.WriteLine("IconIndex=0");
        writer.Flush();
    }

    return UrlPath;
}

称呼为

CreateDeskTopShortcut("https://ipAddress/website/Login.aspx","E:\Setup_Local\Server.ico");


推荐答案

看起来Windows缓存了图标路径,即使删除文件也仍然存在。我不知道此缓存存储在哪里,或者它是否在重启后仍然存在。我的复制步骤如下:

It looks like Windows caches the icon path, and this persists even if you delete the file. I have no idea where this cache is stored, or if it persists beyond a reboot. My reproduction steps were as follows:


  1. 致电CreateDeskTopShortcut( http://www.google.co.uk , \path\to.ico);

  2. 按预期方式创建的快捷方式图标。

  3. 删除快捷方式,然后调用CreateDeskTopShortcut( http://www.google .co.uk , \other-path\to.ico);

  4. 已创建快捷方式,但具有步骤1中的图标。

  5. 将快捷方式名称从测试更改为 Test2。重复步骤3。

  6. 已创建快捷方式,并带有预期的图标。

  1. Call CreateDeskTopShortcut("http://www.google.co.uk", "\path\to.ico");
  2. Shortcut created with expected icon.
  3. Delete shortcut and call CreateDeskTopShortcut("http://www.google.co.uk", "\other-path\to.ico");
  4. Shortcut created, but with icon from step 1.
  5. Change shortcut name from 'Test' to 'Test2'. Repeat step 3.
  6. Shortcut created, with expected icon.

因此使用的图标似乎映射到快捷方式的名称。

So the icon used seems to be mapped to the name of the shortcut.

这篇关于桌面上的Internet快捷方式Windows 7不显示图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆