Some applications let you change the icon for the app from within settings.
I was originally going to suggest looking into loadicon or loadimage routines, but this would only keep the icon while the program is running. Chances are, it uses some system calls to set the icon, much like you can do with shortcuts or folders when you right click and choose properties.
If you talk for console application, method with Resource Hacker will not help. :)
If you use Borland C++, step-by-step:
1) Open your project.
2) Go to View > Project Manger.
3) Find and delete file "projectname.rsc".
4) Open project folder, then create new text document containing:
1 ICON "icon.ico"
Of course, replace icon with you icon name and change your icon name.
5. Then save file with extension "filename.rc", and open again Borland, and add resource file from Project Manger (Project > Add to project).
If you use other compiler, proceed is so-so alike think...
Enjoy!
P.S.: Excuse me for my bad english, but he is not my native language... ;)
ResHacker will work just fine for both windows and console applications. The only difference between the two, as far as representing them, is a single bit in the PE32 header. The program's main icon resource should be named MAINICON.
Windres is a GCC program to compile .rc files into .res files. Borland's is brcc32.
You can load any icon you want and display it at runtime, but it is impossible to directly modify your executable while it is running.
Can you describe exactly when and how you want your icon to change, and for what purpose?
After compiling .exe file , how to change it's icon?
I must be reading this completely wrong.. everyone who has replied has assumed he meant how to change it's icon permanently.. before shipping it out.
At which point.. just changing the icon in the resource file, and re-compiling should be more than enough to do the trick.
I for some reason thought he meant from within the program, kinda like how Winamp lets you select which icon you wish to use from a list of icons, in it's prefferences.
ok.. then yea.. simply change the icon in the resource file and re-compile. the only object that should need re-compiling is the resource part, so it shouldn't be a very big compile time.