Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change icon for a Delphi console application

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

The application settings is greyed in a console application.

Bye.

like image 452
RRUZ Avatar asked Oct 26 '09 21:10

RRUZ


3 Answers

if you add

application.Run; 

somewhere in your dpr file you can use the project->options to change the icon. After you have changed the icon just remove "application.Run;" again and you can compile/build with new icon.

like image 148
Ulrik Avatar answered Nov 06 '22 07:11

Ulrik


If the option to change the icon is disabled, then it is because you have deleted or neglected to add the following line from your DPR file:

{$R *.res}

Put it back, or add it if you never had it. The icon setting will be re-enabled, as will the version-information settings. If the resource file does not exist, then the IDE will create it for you. Do not edit that resource file (such as to add your own icons or other resources); it is for the IDE's use only.

like image 23
Rob Kennedy Avatar answered Nov 06 '22 09:11

Rob Kennedy


According to a July 2007 blog article by Nibu Thomas, there seems to be a SetConsoleIcon WinAPI function.

Alternatively just put the icon in a resource file. Windows should use the first icon it encounters in the application's resources as the application icon.

like image 20
jpfollenius Avatar answered Nov 06 '22 08:11

jpfollenius