Daniel
Daniel

Reputation: 1114

How to reset icon set with AppUserModel.RelaunchIconResource?

At some point I have set AppUserModel.RelaunchIconResource ID to 0 and now program doesn't have an icon in taskbar.

Breaking code:

IPropertyStore propStore = GetWindowPropertyStore(hwnd);
using (PROPVARIANT pv = new PROPVARIANT(0)
    propStore.SetValue(PROPERTYKEY.System.AppUserModel.RelaunchIconResource, pv);
Marshal.ReleaseComObject(propStore);

Icon is missing even if I don't set AppUserModel.ID when window is opened.

Icons is also missing if I use AppUserModel.ID that had icon deleted in the past and even if I try setting a new icon

using (PROPVARIANT pv = new PROPVARIANT(@"C:\path\prog.exe"))
    propStore.SetValue(PROPERTYKEY.System.AppUserModel.RelaunchIconResource, pv);

I have tried setting icon without specifying AppUserModel.ID

Icon is OK if I set the AppUserModel.ID to a random string, but not if I omit it or use one of old broken AppUserModel.ID.

How can I get the icon back for already broken AppUserModel.ID or if I don't set AppUserModel.ID at all?

I have tried searching registry for program's full path and also for the broken AppUserModel.ID.

Upvotes: 0

Views: 105

Answers (0)

Related Questions