Author Topic: How to change icon in .exe (App Wxwidgets with C++)  (Read 6080 times)

Offline wnap

  • Single posting newcomer
  • *
  • Posts: 2
How to change icon in .exe (App Wxwidgets with C++)
« on: March 19, 2016, 05:13:09 am »
I build app with Code::Block, C++ and Wxwidgets. I changed icon for frame successfully, but icon at file .EXE is still there.

Image 01: http://i.stack.imgur.com/JXYrc.png

Image 02: http://i.stack.imgur.com/GPwqR.png

What am I going to do now to change icon at .exe file?

Thanks,

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How to change icon in .exe (App Wxwidgets with C++)
« Reply #1 on: March 29, 2016, 06:02:38 am »
What am I going to do now to change icon at .exe file?
You'll need to use a resource file (*.rc) on Windows. Read the spec on MSDN how this works, you can inspect the sources of C::B for an example. Make sure you name your icon in a way that it appears at first in the resource list.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline raynebc

  • Almost regular
  • **
  • Posts: 217
Re: How to change icon in .exe (App Wxwidgets with C++)
« Reply #2 on: March 29, 2016, 12:22:14 pm »
As an example, the project I work on uses an rc file for this:
https://raw.githubusercontent.com/raynebc/editor-on-fire/master/src/eof.rc
https://raw.githubusercontent.com/raynebc/editor-on-fire/master/src/eof.ico

The RC file is a simple text file with this content:
Code
allegro_icon ICON myfilename.ico
That's with a carriage return and line feed at the end of the line (Windows style encoding), in case this makes a difference.  The ICO file itself seems to be a pretty standard Windows icon image.  When I open that in GIMP, it appears to have 5 layers, each with the graphic in a different size.