【问题标题】:How do I set AppUserModelID on shortcut?如何在快捷方式上设置 AppUserModelID?
【发布时间】:2011-02-18 17:50:21
【问题描述】:

我正在使用 Windows 7 将两个应用程序与相同的任务栏图标结合起来,如以下问题所述:

Pinning advertised shortcuts on the taskbar in windows 7

我在那里看到了很多在线文档,我需要将 AppUserModelID 设置为快捷方式的属性。我的安装程序使用基本的 Visual Studio 2008 安装项目,我看不到任何方法可以在安装时设置快捷方式属性。有没有人可以给我关于如何做到这一点的任何先机?

【问题讨论】:

  • 这方面有什么进展吗?我在 VS2010 项目中遇到了同样的问题

标签: windows-7 installation taskbar


【解决方案1】:

Sheng 评论说:“您还可以切换到其他支持为快捷方式设置 appid 的 MSI 创作工具,例如 WIXNSIS。”

要在 Wix 中使用 Shortcut 元素实现此目的,您必须向 Shortcut 元素添加一个子 ShortcutProperty 元素,并使用 Shell 属性名称“System.AppUserModel.ID”作为键。

    <Shortcut Id="StartMenuShortcut"
              Name="Shortcut Name"
              Description="Shortcut Description"
              Target="[INSTALLLOCATION]Application.exe"
              WorkingDirectory="INSTALLLOCATION">
      <ShortcutProperty Key="System.AppUserModel.ID" Value="AppUserModelID" />
    </Shortcut>

【讨论】:

【解决方案2】:

我对 VS2k8 设置项目一无所知,所以我不知道您是否可以运行自定义操作等,但我知道要在加载/创建快捷方式并查询其 IShellLink 的快捷方式上设置 AppId对于IPropertyStore,然后 InitPropVariantFromString 使用您的 id 的变体并调用 SetValue(PKEY_AppUserModel_ID,propvariant) + 在 propertystore 上提交

【讨论】:

    【解决方案3】:

    添加到安德的回复中。

    Visual Studio 安装项目不支持设置 appid 并且可能永远不会支持,除非 Microsoft 反向 the deprecation of Setup project feature

    There is a Windows API Code Pack that helps in invoking shell APIsHere 是关于在自定义操作中创建快捷方式的教程。您可以添加代码以更新自定义操作的快捷方式。

    您还可以切换到其他支持为快捷方式设置 appid 的 MSI 创作工具,例如 WIX 或 NSIS。

    【讨论】:

    猜你喜欢
    • 2019-09-04
    • 2015-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多