windowsexplorerfile-typestartmenu

Windows Explorer & custom shortcut file types


Windows has a flag in file registrations called "IsShortcut". When this flag is set, the file is automatically given the shortcut icon overlay and is treated as a shortcut in other ways (for instance, when you right click and select "Create Shortcut", it simply copies the file instead of generating a .lnk file). Microsoft uses this feature for ClickOnce Application References (extension .appref-ms).

We use this feature for a custom shortcut file type for our own software, and what we have found is that since Windows 10 (or possibly Windows 8), our custom shortcuts do not appear in the Start Menu. The Start Menu of course lists .lnk files, and it does include .appref-ms files as well, but our own file format, whose registration does not appear substantively different from .appref-ms files, is excluded from the Start Menu. The shortcut files are physically present within the Start Menu folder structure (%APPDATA%\Microsoft\Windows\Start Menu\Programs) but are ignored by Windows Explorer. Other shortcut types (.lnk and .appref-ms) in the same directory do show up.

What I'm looking for is some indication of how Windows Explorer determines which file formats it will include in the Start Menu, so that when developing a custom format, it can be indicated in the same manner. Our custom format worked fine in Windows XP, Windows Vista and Windows 7, but the newer Start Menu design for some reason excludes our file format, even though it is marked IsShortcut in the same manner as .appref-ms files.

Is this possible to do? :-)


Solution

  • To show the link in Windows 10 startmenu, IPropertyStore.GetValue must be implemented and return some unique string for PKEY_AppUserModel_ID property.

    To show the icon in Windows 10 startmenu, IExtractIconW.GetIconLocation must be implemented and owner of the registry key with CLSID class (i.e. HKEY_CLASSES_ROOT\CLSID{42465C3A-83D3-4310-B27D-F271DE372764}) must be "NT Service\TrustedInstaller"

    Here is sample implementation (enhanced Jonathan Gilbert code): https://github.com/publee/CustomShortcutFileType