I have a MFC Dialog Application. I would like to replace the application exe icon.
- I open the default MFC icon eg. app.ico in the res folder using Axialis IconWorkshop.
- Replace all images in the icon.
- Save it to appA.ico.
- Then I change Filename property of icon IDR_MAINFRAME to res\appA.ico.
- Visual Studio icon editor shows the correct image.
But when I build the application, the icon associated to the app.exe still show MFC default icon.
What went wrong?
I think I recall that it is the first icon in the .RC file that is used, no matter what you do, so you might have to edit the .RC file directly, like djeidot says.
One of the Visual Studio files caches some resources; unfortunately I can't remember which one at the moment. Rename those files with odd extensions to something else and try a rebuild.
I have same problem and solve it by : 1.clear solution 2.open task manager and goto details tab. 3.search for explorer.exe and right click on it and end task. 4.goto File->run new task, type explorer.exe 5.now build the solution and check application icon.
In these cases the Visual Studio designer is a little buggy (or, otherwise, by design but incomprehensible). It's best to edit the .rc code file and change the icon filename there.
Sometimes, Windows caches icons. It may not be a problem with your application. Try downloading something like Resource Hacker
and look at your exe file. If the icon looks right, there is an IconCache.db or similar in your appdata\Local folder (depending on Windows version). Delete that and reload Explorer.
I have same problem and solve it by this solution: