Skip to content

Update remarks on taskbar icon precedence - #120

Open
Hu Jialun (SuibianP) wants to merge 1 commit into
MicrosoftDocs:docsfrom
SuibianP:patch-1
Open

Update remarks on taskbar icon precedence#120
Hu Jialun (SuibianP) wants to merge 1 commit into
MicrosoftDocs:docsfrom
SuibianP:patch-1

Conversation

@SuibianP

Copy link
Copy Markdown

Clarified that existing shell link icons and RelaunchIconResource take precedence over this method.

Clarified that existing shell link icons and RelaunchIconResource take precedence over this method.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — accurate improvement. Approved.

@GrantMeStrength

Copy link
Copy Markdown
Collaborator

Copilot /review

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed ✅ — Documentation improvement looks good.

@SuibianP

Copy link
Copy Markdown
Author

It would also have been nice if there is some official documentation regarding the icon logic (taskbar, peek, titlebar, jump list, task switcher).

  • RT_GROUP_ICON resource in the PE executable
  • WM_SETICON (ICON_BIG/ICON_SMALL)
  • Window class icon (WNDCLASSEX::hIcon/hIconSm)
  • RelaunchIconResource
  • Icon of RelaunchCommand
  • Existing shell links (implicit/explicit)
  • Explorer caching, etc.

From my preliminary testing, it seems that for taskbar,

  • TaskbarButtonCreated triggers at the following time,
    • Window shown
    • AUMID set and committed
    • ITaskbarList3::AddTab
  • Upon every TaskbarButtonCreated, the taskbar icon refreshes following this priority,
    1. IconLocation in existing links with the same AUMID or pointing to the same executable (white paper icon if not accessible, RT_GROUP_ICON if no IconLocation)
    2. RelaunchIconResource (if AUMID set)
    3. ICON_BIG
    4. ICON_SMALL
    5. hIcon
    6. hIconSm
    7. RT_GROUP_ICON
  • Upon creation of shell link, the IconLocation is chosen in the following order,
    1. RelaunchIconResource, if AUMID, RelaunchCommand and RelaunchDisplayNameResource are set
    2. Icon of RelaunchCommand, if AUMID and RelaunchDisplayNameResource are set
    3. None
  • On first taskbar right click, if there is a real icon candidate per the last point, an implicit shortcut is created with it, the taskbar item recreated (context menu closes on its own) and TaskbarButtonCreated triggered, even without clicking pinning. In order to change the icon again, it is needed to manually delete it, and either call SHChangeNotify(SHCNE_DELETE) or restart explorer.
  • Any %systemdir% in the icon path (as per https://learn.microsoft.com/en-us/windows/win32/properties/props-system-appusermodel-relaunchiconresource) renders properly on set, but does not get expanded in shell links. As such, on right click, it produces a shell link without path expansion and renders a vanilla icon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants