Program Icon In Explorer Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Program Icon In Explorer

Post 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"
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Program Icon In Explorer

Post 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
Use the source, Luke!
Radek
Super wx Problem Solver
Super wx Problem Solver
Posts: 286
Joined: Sun Sep 11, 2011 7:17 am

Re: Program Icon In Explorer

Post 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".
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Program Icon In Explorer

Post by Tapsa »

Thanks, it works now.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Program Icon In Explorer

Post 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"
Use the source, Luke!
Post Reply