2
votes

I am changing the icon by doing the following in the Main form:

 this.Icon = myIcon; 

And this works fine in Windows 7 except when I "pin" the application to the taskbar, this seems to have no effect on the taskbar icon and only affects the top/left of the window icon.

How do I ensure that I can change the application taskbar icon as well in Windows 7 without having to use Windows 7 Icon overlays as that will just be overlaying another graphic on the icon but not changing the main icon?

1
The answers at the other question don't seem too satisfactory. I think you are going to need to roll up your sleeves and get into some good old fashioned win32 shell programming. AppUserModelID seems to be the key. Enjoy!David Heffernan
Thanks. It seems like I am doing something that I am not supposed to if I am having to dive into win32 shell :P. I guess I should really be using icon overlays but the thing is our application icon colour changes based on the state of the application, but we will probably look at moving to an overlay. Was going to pursue this if it was easy enough to do.lahsrah
I think it's not too hard to change the icon. Of course, if your app terminates unexpectedly, the icon will be the wrong colour. Overlays sound like the more normal way to indicate state.David Heffernan
Yea I would rather not implement a hack that involves changing a shortcut icon that will stay in an inconsistent state when the application crashes. Thanks for your input.lahsrah

1 Answers

0
votes

Pinned app actually creates a windows shortcut. So to do this will have to manipulate a windows shortcut file on disk. Not a good idea as it seems hacky. Decided to use overlays instead.