有没有办法在 Windows CE 上创建桌面快捷方式?

有没有办法在 Windows CE 上创建桌面快捷方式?

我已经为 WinCE 创建了一个应用程序,我想知道是否有办法从桌面创建 .exe 文件的快捷方式。任何帮助或建议都将不胜感激。

答案1

你必须手动使用记事本创建一个快捷方式文件(.lnk),通过计算.exe文件路径中的字符总数(包括空格和斜杠),那么文件中的内容应该是这样的:

(total number of characters)#(path to exe file)

然后你就可以保存它了。

完整信息:https://msdn.microsoft.com/en-us/library/ms861519.aspx

答案2

我知道这已经晚了,但是这里有一些代码可以提供帮助(谢谢@Keanu73):

public static void AddAppShortcutToDesktop()
{
    using (var sw = new StreamWriter(@"\Windows\Desktop\My New Shortcut.lnk", false, Encoding.UTF8, 4096))
    {
        var appExeFilePath = "<Path to Exe>"; // \Program Files\MyApp\MyApp.exe
        sw.Write(appExeFilePath.Length);
        sw.Write("#");
        sw.Write("\"" + appExeFilePath + "\"");
    }
}

相关内容