How to avoid SetCurrentProcessExplicitAppUserModelID causing duplicating of the taskbar icon?

Nikita Provotorov 21 Reputation points
2020-10-30T10:30:06.03+00:00

Hi!
I edited the official Microsoft sample of using custom Jump Lists in that way it invokes SetCurrentProcessExplicitAppUserModelID system call right when wWinMain started. Then if I pin the built application to the taskbar and run it, Windows duplicates its icons:
36257-image.png

How can I avoid it except "do not use SetCurrentProcessExplicitAppUserModelID"? I really need custom AppUserModelId for my production application.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,613 questions
{count} votes

Accepted answer
  1. RLWA32 45,476 Reputation points
    2020-11-02T10:53:24.387+00:00

    Since your concerns revolve around an actual application and not a standalone sample I did another test.

    I created a Windows Installer (.msi) for the CustomJumpListSample. The executable was installed to a folder under Program Files and a shortcut to the executable was installed to the user's start menu. As documented at where-to-assign-an-appusermodelid the MsiShortcutProperty table was used.

    After installing the sample application and before running it, I navigated to the installed executable under Program Files and manually pinned it to the taskbar. Note that I used the .exe for pinning, not the shortcut.

    Subsequently, multiple running instances of the CustomJumpListSample did not produce duplicate icons on the taskbar.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. RLWA32 45,476 Reputation points
    2020-11-01T13:11:50.16+00:00

    You can avoid the problem by creating a shortcut (IShellLink) to the application and setting the System.AppUserModel.ID property in the shortcut's property store to the value that the application passes to SetCurrentProcessExplicitAppUserModelID. Pin the shortcut to the taskbar.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.