代码之家  ›  专栏  ›  技术社区  ›  Clyde

如何在快捷方式上设置appusermodelid?

  •  10
  • Clyde  · 技术社区  · 16 年前

    我在Windows7中正致力于将两个应用程序与同一任务栏图标相结合,如本问题所述:

    Pinning advertised shortcuts on the taskbar in windows 7

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

    3 回复  |  直到 7 年前
        1
  •  8
  •   Stein Åsmul    7 年前

    sheng评论道,“你也可以切换到其他msi创作工具,这些工具支持为快捷方式设置appid,比如 威克斯 NSIS ."

    要使用wix中的快捷元素实现此目的,必须添加一个子元素 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
  •  2
  •   Anders    16 年前

    我对vs2k8安装项目一无所知,所以我不知道您是否可以运行自定义操作等,但我知道要在快捷方式上设置appid,您可以加载/创建快捷方式并查询 IShellLink 对于 IPropertyStore ,然后initpropvariantfromstring带有您的id和调用setvalue的变量( PKEY_AppUserModel_ID ,propvariant)+在propertystore上提交

        3
  •  1
  •   hurst    15 年前

    添加到ander的回复中。

    visual studio安装项目不支持设置appid,除非microsoft反向 the deprecation of Setup project feature

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

    您还可以切换到其他msi创作工具,这些工具支持为快捷方式(如wix或nsis)设置appid。