Page 1 of 1

Program Icon In Explorer

Posted: Mon Dec 19, 2011 10:13 pm
by Tapsa
I haven't been able to set an icon for my application to show up in explorer.
Could someone tell me what's wrong with this?

Code: Select all

/* Resources.h */

#ifndef Resources_h
#define Resources_h

#define iconAppIcon 0
#define USE_wxICONS 0

#endif

/* Resources.rc */

#include "Resources.h"
#include "wx/msw/wx.rc"

iconAppIcon ICON "AppIcon.ico"

Re: Program Icon In Explorer

Posted: Mon Dec 19, 2011 10:32 pm
by doublemax

Code: Select all

#define iconAppIcon 0              // remove this line
#define USE_wxICONS 0              // what's this supposed to do?

#endif                             // that should probably be at the end of the file

Re: Program Icon In Explorer

Posted: Tue Dec 20, 2011 8:47 am
by Radek
(1) IIRC, the resource ID cannot be zero. Change "#define iconAppIcon 0" to "#define iconAppIcon 1". Or, delete the statement, winblows will use a text-based resource ID "iconAppIcon" instead.
(2) IIRC, the icon used by Explorer is the first resource in your .rc file. Make sure that

Code: Select all

iconAppIcon ICON "AppIcon.ico"
is the first item in your .rc file. If the ICON resource is preceded by some non-ICON resource then Explorer or other icon showing app need not find the icon, even if it is the first icon in the .rc file. You can always set the app icon using "Properties".

Re: Program Icon In Explorer

Posted: Tue Dec 20, 2011 9:18 am
by Tapsa
Thanks, it works now.

Re: Program Icon In Explorer

Posted: Tue Dec 20, 2011 2:23 pm
by doublemax
Just a small correction to what Radek said:
Windows will use the first icon in alphabetic order from the resource. That's why you often see stuff like this in a resource file to make sure that it's the first.

Code: Select all

aaaaAppIcon ICON "AppIcon.ico"