How do I change the program icon for a Delphi console application?
The application settings is greyed in a console application.
Bye.
asked Oct 26, 2009 at 21:48
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.
TLama
74.5k17 gold badges208 silver badges380 bronze badges
answered Oct 26, 2009 at 21:55
jpfolleniusjpfollenius
16.3k10 gold badges90 silver badges156 bronze badges
0
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.
answered Oct 26, 2009 at 22:33
Rob KennedyRob Kennedy
161k21 gold badges276 silver badges463 bronze badges
3
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.
answered Jan 25, 2010 at 14:09
UlrikUlrik
1111 silver badge2 bronze badges
4
Simply change the Icon in your apps resource file (say your app project is called ConsoleApp.dpr, your app resource file will be ConsoleApp.res)
The main icon resource in there is intuatively called MAINICON, just replace it.
Here is a step by step for C++ Builder (the steps are basically the same in Delphi)
answered Oct 26, 2009 at 22:03
Tim JarvisTim Jarvis
18.2k9 gold badges54 silver badges91 bronze badges
- add {$R *.res} in your DPR file
- comment {$APPTYPE CONSOLE} line in your DPR file
- edit Project -> Options -> Application -> Icon
- uncomment {$APPTYPE CONSOLE} line in your DPR file
Tested with Delphi XE
answered Jul 17, 2013 at 13:47
Stéphane B.Stéphane B.
3,2002 gold badges28 silver badges35 bronze badges
How do I change the program icon for a Delphi console application?
The application settings is greyed in a console application.
Bye.
asked Oct 26, 2009 at 21:48
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.
TLama
74.5k17 gold badges208 silver badges380 bronze badges
answered Oct 26, 2009 at 21:55
jpfolleniusjpfollenius
16.3k10 gold badges90 silver badges156 bronze badges
0
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.
answered Oct 26, 2009 at 22:33
Rob KennedyRob Kennedy
161k21 gold badges276 silver badges463 bronze badges
3
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.
answered Jan 25, 2010 at 14:09
UlrikUlrik
1111 silver badge2 bronze badges
4
Simply change the Icon in your apps resource file (say your app project is called ConsoleApp.dpr, your app resource file will be ConsoleApp.res)
The main icon resource in there is intuatively called MAINICON, just replace it.
Here is a step by step for C++ Builder (the steps are basically the same in Delphi)
answered Oct 26, 2009 at 22:03
Tim JarvisTim Jarvis
18.2k9 gold badges54 silver badges91 bronze badges
- add {$R *.res} in your DPR file
- comment {$APPTYPE CONSOLE} line in your DPR file
- edit Project -> Options -> Application -> Icon
- uncomment {$APPTYPE CONSOLE} line in your DPR file
Tested with Delphi XE
answered Jul 17, 2013 at 13:47
Stéphane B.Stéphane B.
3,2002 gold badges28 silver badges35 bronze badges
Go Up to Developing Multi-Device Applications
Having a great-looking application icon is a must-have to increase your chance of success in the application stores. Your app icon represents your app in the application stores as well as on the target platform. This page explains how to configure the icons of your application using RAD Studio.
Contents
- 1 Default Icons
- 2 Required Icon Sizes
- 3 Storing Your Icon Files into an Icon Container
- 4 Configuring Your App Icons
- 5 Troubleshooting
- 5.1 Cannot Add a 1024×1024 Icon into an macOS Icon Container
- 5.2 Cannot Define an App Icon for My Command-Line Application
- 6 See Also
Default Icons
Some platforms do not allow running applications that do not provide application icons. RAD Studio provides default application icons, so that you can test your application on any platform even if you do not have icons for your application yet. However, before you publish your application you must replace the default RAD Studio icons with custom icons for your application. The following sections explain how to configure your application to use your custom icons.
The table below shows the paths where you can find the RAD Studio default icons, relative to the RAD Studio installation path: C:Program Files (x86)EmbarcaderoStudio21.0
. If you want all your new projects to use your own icons, replace these default icon files with your own files.
Platform | Image | Path | Notes |
---|---|---|---|
Windows | bindelphi_PROJECTICON.ico
|
Used for Delphi applications. | |
bincbuilder_PROJECTICON.ico
|
Used for C++Builder applications. | ||
macOS | bindelphi_PROJECTICON.icns
|
Used for Delphi applications. | |
bincbuilder_PROJECTICON.icns
|
Used for C++Builder applications. | ||
iOS | binArtworkiOS
|
||
Android | binArtworkAndroid
|
Required Icon Sizes
When you deploy your application, you must provide your application icon in different resolutions. The icon resolutions that you need depend on the target platform. Platforms may show your application icon in different contexts, such as an application launcher or a settings window. Depending on the context where your application icon is displayed, a different icon size may be required.
You should design different versions of your icon to support each of the resolutions that each one of your target platforms supports. Using a single icon and resizing your icon to fit each resolution is seldom a good idea. Even vector images require some adjustments on specific resolutions to look good in all resolutions.
The table below shows icon resolutions that the Windows and macOS platforms use. Each value under Icon resolutions in the table stands for the number of pixels per side of an icon. For example, 16 stands for an icon resolution of 16×16 pixels.
For iOS and Android resolutions, check the Application Options page.
- Note: Some platforms do not allow running applications that do not provide certain resolutions of application icons.
For example, macOS applications must include 512×512 icons to be accepted in the Apple App Store.
Platform | Icon resolutions | ||||||
---|---|---|---|---|---|---|---|
16 | 32 | 48 | 128 | 256 | 512 | 1024 | |
Windows |
|||||||
macOS |
|||||||
iOS |
See icons for iOS apps in Application Options. |
||||||
Android |
See icons for Android apps in Application Options. |
Note: An easy way to create multiple resolutions of your icons is to use the MultiResBitmap Editor, available in the IDE.
For more information, see Using Multi-Resolution Bitmaps.
Storing Your Icon Files into an Icon Container
Once you have your app icon in all the resolutions that a target platform requires, for desktop platforms you must then archive the different resolutions of your icon into a single file, an icon container, that you can deploy along with your application.
For Windows, you must create an .ico
icon container file. See How to make/get a multi size .ico file?.
For macOS, you must create an .icns
icon container file. See Use iconutil to Create an icns File Manually. Alternatively, you can use the RAD Studio ico2icns command-line tool to convert an existing .ico
file into an .icns
file.
On mobile platforms you do not need to provide an icon container file, you provide your application icons separately instead.
Configuring Your App Icons
Once you have your application icon files, select Project > Options > Application and provide the local paths of your icon files for each target platform. See Application Options for more information.
- Note: If you do not specify an
.icns
file, required for macOS, but you do specify an.ico
file, RAD Studio converts your.ico
file into an.icns
file and uses the resulting.icns
file when you deploy your application for macOS.
Troubleshooting
Cannot Add a 1024×1024 Icon into an macOS Icon Container
In order to include an application icon with a resolution of 1024×1024 pixels into an .icns
file, you must be running macOS Lion or a later version of macOS.
Cannot Define an App Icon for My Command-Line Application
For command-line applications, setting the application icon is disabled. Platforms which support command-line applications use a standard console-mode icon by default.
See Also
- Application Options
- MultiResBitmap Editor
- Using Multi-Resolution Bitmaps
- MacOS Application Development
- Creating an Android App
- Preparing an iOS Application for Deployment
- Image List Editor
- Developing the Application User Interface Index
5683 / 2274 / 466 Регистрация: 20.11.2009 Сообщений: 7,655 Записей в блоге: 1 |
|
1 |
|
Изменение иконки программы24.01.2011, 15:14. Показов 14788. Ответов 10
В общем задача такая не трудная, но я не знаю даже с чего и начать ее решать
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
24.01.2011, 15:14 |
Ответы с готовыми решениями: Изменение иконки приложения Изменение иконки у чужого exe Иконки для программы… Иконки для программы 10 |
Mobile Software Engineer 5365 / 1584 / 956 Регистрация: 23.01.2011 Сообщений: 3,214 |
|
24.01.2011, 16:14 |
2 |
вам нужно сменить иконку на форме или же и ярлык программы тоже?
0 |
85 / 85 / 59 Регистрация: 14.05.2010 Сообщений: 223 |
|
24.01.2011, 16:25 |
3 |
вот я попробовал такой способ:
0 |
Mobile Software Engineer 5365 / 1584 / 956 Регистрация: 23.01.2011 Сообщений: 3,214 |
|
24.01.2011, 16:45 |
4 |
вот так вот сделайте:
0 |
Mobile Software Engineer 5365 / 1584 / 956 Регистрация: 23.01.2011 Сообщений: 3,214 |
|
24.01.2011, 16:49 |
5 |
вот скрин…думаю понятно Миниатюры
0 |
Фрилансер 452 / 433 / 117 Регистрация: 01.06.2010 Сообщений: 1,314 |
|
24.01.2011, 16:52 |
6 |
Ev[G]eN, ты мозг включи!!! Тс пишет мне понадобилось программно менять иконку на окне а ты ему скрины в DesignTime предлагаешь!!!
0 |
Mobile Software Engineer 5365 / 1584 / 956 Регистрация: 23.01.2011 Сообщений: 3,214 |
|
24.01.2011, 16:53 |
7 |
не внимательно про4ел…
0 |
Arcor 5683 / 2274 / 466 Регистрация: 20.11.2009 Сообщений: 7,655 Записей в блоге: 1 |
||||
24.01.2011, 18:21 [ТС] |
8 |
|||
вот скрин…думаю понятно Позновательно !!! Добавлено через 8 минут
Мне вот крит выдает постояно…. Добавлено через 7 минут
0 |
85 / 85 / 59 Регистрация: 14.05.2010 Сообщений: 223 |
|
24.01.2011, 19:13 |
9 |
так я собственно, полагаю, что правильно понял Ваш вопрос, именно та самая иконка, в том самом углу и программно…
0 |
5683 / 2274 / 466 Регистрация: 20.11.2009 Сообщений: 7,655 Записей в блоге: 1 |
|
24.01.2011, 21:52 [ТС] |
10 |
так я собственно, полагаю, что правильно понял Ваш вопрос, именно та самая иконка, в том самом углу и программно… Дада все как нужно, только как еще поменять иконку когда она в трее находится(на нижней синей полоске у Windows XP)
0 |
Zaxelf 85 / 85 / 59 Регистрация: 14.05.2010 Сообщений: 223 |
||||
24.01.2011, 22:02 |
11 |
|||
//ну видимо перед использовванием этой процедуры надо заменить её в углу формы, я давно не использую иконку в трее, если работать не будет напиши в прошлом году, когда я этим пользовался — работало нормально
0 |