2
votes

I am finishing a C++ MFC application and wish to update the icon that is shown in the bottom taskbar for Windows. I am using Visual Studio I have found the .ico file in VS. I removed or updated all versions of the MFC logo.

Example MFC Icon

When my program first starts, the above image is shown as the icon. When I log in and load the second form, I get my icon:

My Icon

I am trying to find out why the first form reverts to the old MFC icon. In my .ico file, I can find no trace of the MFC icon. Thanks.

2
Windows has an icon cache for applications that is hard to reset. Search for ways to do it and see if it makes a difference.Mark Ransom
To everyone having a problem with this, make sure you Rebuild your solution as well.Kyle Williamson

2 Answers

1
votes

An MFC application always displays its own ICON for application and dialog.. you can change it by replacing the icon file for the resource called IDR_MAINFRAME

SetIcon sets the icon on the dialog title bar (small icon) and when you use Alt-tab (big icon)

The icons you see in the Windows Explorer are the main Application Icons (the icon with the lowest ID in your rc file).

As Mark suggested, you can have a look at: http://www.winability.com/repair-windows-desktop-icon-cache/

1
votes

Make sure you run

ie4uinit.exe -ClearIconCache

from a DOS Command window. You can change properties of IDR_MAINFRAME in the Resource view or edit the .rc file in the text editor, then re-compile resources by right-clicking on the .rc file or use CTRL+F7. These are all the changes necessary when changin the default MFC icon in an MFC Visual Studio 20155 application.