EXE Icon

When an EXE file is created by a compiler, it has the standard rectangle icon. How do I change it to my own icon? Do I have to do this through code or I can right-click the file's icon on the desktop and change choose a new icon through the display properties window?
create a resource file with an icon in it. Explorer will automatically show that icon since it will be stored in the .exe.

Resource file:
 
101 ICON C:\myicon.ico


I'm not sure how to do it if there are more icons in your exe tho.
Last edited on
Thanks :)
This will do since I don't need more icons.
Your resource file should look something like
1
2
MAINICON ICON "foo.ico"
ANOTHER  ICON "baz.ico"

You will need to tell your compiler how to compile and link the resource file.

Using the GCC, you would first use WindRes:

windres resources.rc resources.o

Then compile and link with the resources

g++ -o myprog myprog.o resources.o

Other compilers will vary.


The other way to do it (and I good one, I think) is to get Resource Hacker
http://www.angusj.com/resourcehacker/
and use it to replace the icons in the file. You can do it graphically or from the command line. The program comes with documentation.

Hope this helps.
Last edited on
I tried this and found it could changed the shoutcut icon on the desktop.

But it can't change the icon of exe.

If you want change the icon for the exe, you must change the souce code, just the rc file.
I remember it being the first icon in the program (in the resource file) was the one used. Did they change that?
Topic archived. No new replies allowed.