Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have an application(on Windows 10 Build Version 1703) which sets form(MDI Container type) Icon at runtime but the updated Icon didn't get displayed on Taskbar. It only get displayed once I pin and Unpin it. Any solution to this ? Could it be possible to load runtime Icon to taskbar without pin/unpin ? Can we refresh taskbar Icon programmatically so I can change in my application code.

Note: This only occur with installed application and not on Debug/release Dev environment.

What I have tried:

# Restarting Explorer.exe to refresh Taskbar Icon but it didn't work.
# Reconstruction Icon Cache (.db extension), it also didn't work
Updated 22-Jul-20 5:28am
Richard MacCutchan 22-Jul-20 4:03am    
For general applications the icon is loaded at program startup. How are you changing it, and what exactly are you changing?
Member 14895791 22-Jul-20 4:07am    
In Code,

form.Icon = new Icon("status.ico");

where form is MDIContainer.
Richard MacCutchan 22-Jul-20 4:33am    
I just tried that on a simple Windows Form application and it works fine.
Member 14895791 22-Jul-20 4:38am    
It is specifically occur when you have installed application and not on development environment.
Richard MacCutchan 22-Jul-20 4:50am    
I just ran the app stand-alone and it still works. BTW I am on Windows 10 v 1909, not sure if that makes any difference.

1 solution

Just set the MDI form's Icon property.
I created two icons, added them to my resources via the Property page ... Resources tab, "Add Resource", "Add existing files".
Then just set the main form Icon property (not a child form, the App icon on the taskbar comes from the form instance displayed by Application.Run in Program.cs only) from the two resources.

Works for me!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900