Apr 7, 2013 at 6:04am UTC
I am trying to change the icon of my program in Visual Studio 2012, but it just won't change!
What I do is add a new icon resource, and choose my .ico file. Then I include the resource.h file and add to my window class.
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
VS says my .ico contains a 64x64 32bit, 32x32 32bit, 24x24 32bit and a 16x16 32bit image. Are they the wrong resolution or bit maybe?
Could someone explain, step by step, how to add an icon in Visual Studio 2012, please :P
Apr 7, 2013 at 10:09am UTC
Add 16x16 icon handle to hIconSm (small icon) and 32x32 icon handle to hIcon (big icon) members of WNDCLASSEX struct or use WM_SETICON message. Only first icon will show up in windows explorer.
Be aware that VS usually uses a default icon, you need to overwrite or delete that file.
Apr 7, 2013 at 10:47am UTC
For what does it use a default icon?
I think it's Windows who provides a default one in case you don't provide one yourself.
Also, Kuzco, Besides doubling the LoadIcon to wc.hIconSm too, also make sure you aren't using cached icons (Try to delete the icons cache, I think you can do it with CCleaner)
Apr 7, 2013 at 3:04pm UTC
VS creates 2 icons and add them to the project, one named
small.ico and one named <project name>.ico which are compiled into executable itself. You can see them with any resource editor.