Windows 7 Taskbar support with the MsiShortcutProperty table

Starting with Windows 7, Windows Installer enables native support for setting properties on shortcuts created during installation or re-installation. The MsiShortcutProperty table can be used to set any property defined by the IPropertyStore interface.

In order to use the new table, you need to specify the PropertyKey and PropVariantValue for the shortcut you want to set the properties on (you can set multiple properties on a shortcut). The properties allowed are the ones registered in the current property schema. The system-supplied properties are defined in propkey.h: many of them are new in Windows 7. Properties supplied by 3rd parties are also supported, as long as they have been registered with the schema subsystem (for eg. via PSRegisterPropertySchema). 

You can use string representations for both – e.g. System.AppUserModel.ID for the PropertyKey PKEY_AppUserModel_ID, and a corresponding string representation for the PropVariantValue. Windows will automatically coerce the value to the correct type.

MsiShortcutProperty

Shortcut_

PropertyKey

PropVariantValue

AppIDProperty

OrcaNT.406D93CE_00E9_11D2_AD47_00A0C9AF11A6

System.AppUserModel.ID

Microsoft.WindowsInstallerTools.Orca

PreventPinningProperty

OrcaNT.406D93CE_00E9_11D2_AD47_00A0C9AF11A6

System.AppUserModel.PreventPinning

0

These properties are consumed by shell, not windows installer.

Examples:

1. Allow an app to glom onto its shortcut on the taskbar

System.AppUserModel.ID property in Windows 7 defines an AppUserModelID. Applications can use this property to group its windows together with the shortcut on the Windows taskbar. This means that if the application sets an AppUserModelID in its process, and same AppUserModelID in the shortcut, then when the shortcut is pinned to the taskbar and the application is launched from it, the application icon will group together with the shortcut. This property is particularly useful for applications that wish to override the taskbar’s default grouping and unification – apps running under a host process, or an app that owns several different processes. PropertyKey, PropVariantValue that you would author in the MsiShortcutProperty table of your package would be “System.AppUserModel.ID” and “CompanyName.ProductName.SubProduct”, respectively.

2. Prevent pinning of shortcuts

Setting “System.AppUserModel.PreventPinning” property to “1” prevents a shortcut from being pinned to the taskbar.

FAQs

Q: Is there a new standard action that I need to schedule?

A: No, setting of shortcut properties will be a part of the CreateShortcuts standard action.

 

Q: Can I set properties on shortcuts that are not a part of my installation?

A: No, you can only set properties on shortcuts created by your installation.

 

Q: What happens if the setting of a property fails?

A: If Windows Installer fails to set a shortcut property, it will return a warning and the installation will continue.

 

Q: What happens on downlevel platforms?

A: This functionality is only available on Windows Installer 5.0 and above. The MsiShortcutProperty table – if present – is ignored on Windows Installer 4.5 and below.

 

[Author: Ashish Awasthi]
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm.

Comments

  • Anonymous
    September 03, 2009
    Does the MsiShortcutProperty.PropertyKey column also accept strings in the "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2" format used by PSPropertyKeyFromString, or something similar? If so, how does Windows Installer then choose the VARTYPE to which it should coerce MsiShortcutProperty.PropVariantValue?  Does it perhaps use PSGetPropertyDescription followed by IPropertyDescription.CoerceToCanonicalValue?  In which case, PSGetPropertyDescription returns an error for PROPERTYKEYs not supported by the system, making it impossible to: (a) install entirely application-defined properties in a shortcut, or (b) install a Windows 8 aware application on Windows 7 with Windows Installer 5, then upgrade to Windows 8, and have some Windows 8 specific properties already installed in the shortcut.

  • Anonymous
    September 10, 2009
    Dear Kalle Olavi Niemitalo: No, MsiShortcutProperty.PropertyKey column does not accept strings in the "{fmtid} pid" format. You should use the canonical name of a property. The properties allowed are the ones registered in the windows property system. See http://msdn.microsoft.com/en-us/library/bb776909(VS.85).aspx

  • Anonymous
    November 11, 2009
    Are we supposed to set the application id when installing the executable as well?  I have found that if I right-click on my executable and click "Pin to Start Menu" or "Pin to Taskbar", my jumplist doesn't show up.  Is this a bug in Windows 7 or am I supposed to be setting the app id in my binary to allow Windows to figure out what app id to create the shortcut with?