Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set AppUserModelID on shortcut?

I'm in Windows 7 working on combining two apps with the same task bar icon, as described in this question:

Pinning advertised shortcuts on the taskbar in windows 7

I see there, and it lots of online documentation that I need to set the AppUserModelID as a property of the shortcut. My installer program uses the basic Visual Studio 2008 setup project, and I don't see any way to set shortcut properties on installation. Is there any head-start anyone can give me on how to do this?

like image 704
Clyde Avatar asked May 12 '10 16:05

Clyde


2 Answers

Sheng commented that "You can also switch to other MSI authoring tools that supports setting the appid for shortcuts, such as WIX or NSIS."

To achieve this using a Shortcut element in Wix you must add a child ShortcutProperty element to your Shortcut element and use the Shell property name "System.AppUserModel.ID" as the key.

    <Shortcut Id="StartMenuShortcut"
              Name="Shortcut Name"
              Description="Shortcut Description"
              Target="[INSTALLLOCATION]Application.exe"
              WorkingDirectory="INSTALLLOCATION">
      <ShortcutProperty Key="System.AppUserModel.ID" Value="AppUserModelID" />
    </Shortcut>
like image 200
Olly Avatar answered Sep 20 '22 16:09

Olly


I don't know anything about VS2k8 setup projects so I don't know if you can run custom actions etc but I do know that to set the AppId on a shortcut you load/create your shortcut and query its IShellLink for IPropertyStore, then InitPropVariantFromString a variant with your id and call SetValue(PKEY_AppUserModel_ID,propvariant) + Commit on the propertystore

like image 44
Anders Avatar answered Sep 16 '22 16:09

Anders