The use of resources under VC, usually the first in the resource.h to define an integer, such as:
#define IDI_LIGHTNING_R 200//program icon
Then define this icon in Resource.rc:
Idi_lightning_r ICON "Icons\\lightning_r.ico"
When you read the icon, you use:
:: LoadIcon (H, Makeintresource (Idi_lightning_r));
Such a form. With wxwidgets also want to certainly do so, the result with
Pmainwnd->seticon (Wxicon (idi_lightning_r));
It doesn't work anyway.
Look at the next wxwidgetes code:
#define WXICON (X) Wxicon (WXT (#X))
Directly converts the Idi_lightning_r to a string, calling the Wxicon constructor.
wxIcon::wxIcon(const wxString& iconfile,
long flags,
int desiredWidth,
int desiredHeight)
{
LoadFile(iconfile, flags, desiredWidth, desiredHeight);
}
Look down LoadFile:
bool wxIcon::LoadFile(const wxString& filename,
long type,
int desiredWidth, int desiredHeight)
{
UnRef();
wxGDIImageHandler *handler = FindHandler(type);
if ( !handler )
{
// load via wxBitmap which, in turn, uses wxImage allowing us to
// support more formats
wxBitmap bmp;
if ( !bmp.LoadFile(filename, type) )
return false;
CopyFromBitmap(bmp);
return true;
}
return handler->Load(this, filename, type, desiredWidth, desiredHeight);
}
Well, look for the handler that reads the icon, and then use it to do the actual operation, the handler of the icon is done by the Wxicoresourcehandler class, see its Load method:
virtual bool Load(wxGDIImage *image,
const wxString& name,
long flags,
int desiredWidth, int desiredHeight)
{
wxIcon *icon = wxDynamicCast(image, wxIcon);
wxCHECK_MSG( icon, false, _T("wxIconHandler only works with icons") );
return LoadIcon(icon, name, flags, desiredWidth, desiredHeight);
}