I want to change the default icon that shows up at the top left corner of the frame.
I have tried many approaches- xpm, ico, bmp,
using SetIcon(wxIcon(wxT("icon.xpm")));
as suggested here.
I tried different icon sizes, 16x16, 24x24 and 32x32.
I've also tried adding MYICON1 ICON "Logo.ico"
in the resource.rc file, #define MYICON1 101
in the resource.h file and SetIcon(wxIcon(MYICON1));
to the frame constructor..
btw, i'm using wxwidgets 2.8 on visual studio 2010
EDIT:
I've also tried adding
MYICON1 ICON "Logo.ico"
in the resource.rc file,#define MYICON1 101
in the resource.h file andSetIcon(wxIcon(MYICON1));
to the frame constructor..
With this approach, I get an error in the wxIcon(int) constructor..
1>xsframe.cpp(17): error C2248: 'wxString::wxString' : cannot access private member declared in class 'wxString'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\wx/string.h(682) : see declaration of 'wxString::wxString'
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\wx/string.h(659) : see declaration of 'wxString'
PS, xsframe is my main frame. whose icon i'm trying to change.
I am quoting Vaclav's answer from here:
You can set your main frame's icon with wxFrame::SetIcon. Application icon can be changed by adding a new icon resource to your .rc file:
appicon ICON "myapp.ico" #include "wx/msw/wx.rc"
Note that this icon must be the first icon in your .rc file and it must be the first one when you sort your icons alphabetically. This is because MS developers weren't able to make their mind on how to determine app's icon: it is the first one in .rc file under Windows 9x and the alphabetically first one under NT (or vice versa).
Most people usually miss this. Hope that fixes things.