one two
one two

Reputation: 31

Change application taskbar icon at run time(ignore shortcut icon)

I have a program which has two different modes that users can be in. Depending on the mode I want to change the taskbar icon to reflect its state. I've found application.icon will allow me to set any image I want at run time, but there was one problem. When I installed the program, a shortcut is created for the start menu. The shortcut appears to disable the ability to change icon for the task bar. Is there any way to ignore the shortcut icon?

Upvotes: 2

Views: 3063

Answers (1)

Peter
Peter

Reputation: 2977

Shortcuts have nothing to do with how the application icon appears on the taskbar,
a shortcut only points to the actual executable that has the icon embedded as a resource.

Your problem could be the Windows Icon Cache. This is a common scenario where the Icon Cache isn't updated properly. You should rebuild/refresh your icon cache, then you should see the currently loaded application icon appear on the taskbar, and you can then use the Application.Icon.Load... to swap the icons between modes.

It could also be just due to your taskbar options. If you have your taskbar set to combine both Icon + Label then the icon does not change. Make sure that the option is set to don't combine or combine only if taskbar is full.

Upvotes: 1

Related Questions