I am trying to change the default icon that appears in the left side of the task bar. I created a .ico file using a program called, "icon edit." I made all the proper annotations in resource.h and resource.rc; however, I still get the same old default icon in the taskbar. Any suggestions?
I am using codeblocks 8.02 using with a known working program.
#define IDI_ICON 153
call to load icon
IDI_ICON ICON DISCARDABLE "C:\\Users\\Dsve\\Desktop\\Card Bitmaps\\ace icon.ico"
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
This is a 32x32 icon. Program compiles without any errors. Complete code is available upon request. Please offer any suggestions if you see that I am missing something.
...you mean the application icon (that appears next to the title of a top-level window in the taskbar)?
For a moment there I thought you meant the Windows logo that is part of the Start button. :confused:
I have mine defined as
This is also using codeblocks 8.02.
IDD_ICON ICON "icon.ico" //in resource file
SetClassLong(hwnd, GCL_HICON, (LONG) LoadIcon(hInstance, MAKEINTRESOURCE(IDD_ICON))); //in main.cpp file in WM_CREATE message
In my DevC++ when occurs something like that I can solve always deleting the object and layout files, and recompiling it all. Is not an elegant method but it works for me. Hope that helps.
tried all of ye' wonderful suggestions; however, am still unable to get a freaking icon to display in the left side of the running application's taskbar. Another case of good code that doesn't work unless I play the game of musical compilers and/or download some off the wall sdk or check some box in some setting somewhere in some unknown submenu.
Another thought is that the icon file might not be saved correctly. I know when I downloaded some free icon editors some of them did not save it correctly causing it to not display.
Take a look at the Icon Sizes recommendations (on the Win32 Prog Ref), it says:
Maybe is possible that if the icon file 'ace icon.ico' does not accomplish that it will be showed in bad resolution, or at the worst case it won't be displayed.
Your application should supply icon resources in the following sizes:
- 48x48, 256 color
- 32x32, 16 color
- 16x16 pixels, 16 color
Hope that helps
Thanks for your continued efforts on this somewhat frivilous task.. as you can see, I have a 32x32 16 color icon that for some mysterious reason will not show itself in me' program.
I envision a day where code will work equally for everyone.
Have you filled in wc.hIconSm? If it's NULL (or you're not using a WNDCLASSEX) and wc.hIcon doesn't have a 16x16 icon in it, then you get the bog standard icon.
The above is all you need. If I stop on by tomorrow and you haven't gotten it, I'll pack up a small, working example.
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_SMLCON), IMAGE_ICON, 16, 16, 0);
#define IDI_MYICON 010
#define IDI_SMLCON 020
IDI_SMLCON ICON DISCARDABLE "Crazy.ICO"
IDI_MYICON ICON DISCARDABLE "Crazy.ICO"
Here's the example code. This 'il change your titlebar icon and the running window (taskbar) icon.
I'm assuming that this is what you're referring to -