How do I change the program icon for a console application?

By: Vincent Drake

Abstract: Describes how to modify the default application icon that appears in Windows Explorer for console applications.


Question:

When I build a console application in C++Builder, it always appears with the default C++Builder application icon (the blue buildings). The project manager options for application icon are disabled. How can I change this icon?

 
Answer:

Windows usually uses the first icon it encounters in an application's resources as the application icon. C++Builder automatically sets this icon using the 'projectname.res' file. First you must remove this file from the project using the Project Manager. Then create a text file containing:

1 ICON "iconfile.ico"

Of course, replace "iconfile.ico" with the actual name and path to the icon you wish to use. Save this file with a '.RC' extension. Finally, add this file to your project, clicking Project, Add to Project....

Make the project and the application icon should now be changed. Note:Windows 95 and possibly other Window 9x variants do not support this change.

 

Server Response from: ETNASC02