【发布时间】:2014-11-25 05:36:00
【问题描述】:
我正在使用 IwishRuntime 库来动态创建快捷方式。如果图标位于网络路径中,则设置图标位置将不起作用。
例如,如果路径类似于“\\ServerName\Folder\Resources\Userguide.ico”;不会设置图标。 这只发生在 Windows 8 和 8.1 中。它在以前的操作系统中运行良好。
有没有办法解决这个问题。
string path = System.IO.Directory.GetCurrentDirectory() + @"\Upgrade\Resources\userguide.ico";
//Icon Location is set only if the file is there. If the file is not accessible due to security reasons
//Icon location is not set. The default program will be taken as the icon in this case.
if (System.IO.File.Exists(path))
{
shortcut.IconLocation = path;
}
谢谢。
【问题讨论】:
-
您的网络路径应该以两个斜杠 ("\\ServerName\Folder...") 开头,还是拼写错误?否则它可能是一个许可的事情。尝试在同一目录中放置一个随机文本文件并读取它。
-
不,这是一个错字。它以 \\ServerName 开头。事实上,它从 Directory.GetCurrentDirectory() 中读取。所以它返回正确的值。也没有权限问题。我检查了那个。它不适用于以“\\”开头的网络路径。即使对于我自己的机器,如果我将路径作为网络路径 - \\Tharindu\Share\Resources\userguide.ico 它也不起作用。但是,如果我将路径指定为 D:\\...etc 它将起作用。