I've made a VCL application in Delphi, and set the application icon using the Project/Options dialog. I also added additional icons to the application by adding an RC file to the project. None of these is named "MAINICON" in the RC file to avoid conflict with the application icon resource.
The EXE contains all icons: the application icon, and the additional icons listed in the RC file. When I start the EXE, both the main form and the taskbar button will display the application icon, as expected.
The problem is that file managers (Explorer, Total Commander etc.) display one of the additional icons for the exe. Why? Is it possible to make the application icon displayed in file managers?
Thanks!
AFAIK Windows selects the first icon resource, in alphabetical order. So rename your addidional icon resources so that they come after MAINICON in the alphabetical order. Rebuild and clear the icon cashe to see does it fix it.
Related
I have an FMX application created in RAD studio 10.4 and have set the main icon in Project Options, Icons. I have also added 2 additional icons in the resource file using Resources and Images, which will be used by an installer to create file associations. All icons are 32x32 pixels. The main icon appears correctly in the application title bar but not in Windows explorer. It always takes the first of the 2 additional icons in the resource file. At first I thought this could be due to windows caching of icons but it is not. I'm using software called icofx to extract the icons from the exe and I see that the main icon always appears last.
I have tried changing the identifiers in Resources and images with the same result. The identifiers shown in icofx are not the ones I set. I've also tried renaming the additional icons so that they're last alphabetically, but that doesn't work either.
If I try the same with an old Delphi 7 project then it always results in the main application icon appearing first, which is what I want. Any ideas?
I have now resolved the issue by changing the identifiers of the additional icons so that they come after MAINICON alphabetically. The default is Icon_1, Icon_2, which come before MAINICON alphabetically. Changing them to ZIcon_1 and ZIcon_2 resolves the issue so that Windows Explorer takes MAINICON first.
I'm making many VCL form applications using delphiXE5 at present. The icon resource is unnecessary for it.
I'd like to make EXE which doesn't have an icon resource like a console application, but how should it be done?
Open your .dproj file in Notepad or similar editor and delete tags
<Icon_MainIcon>...</Icon_MainIcon>
With this approach your project will still have version information, as well as runtime themes (or custom manifests) enabled.
If you wish to add icon back, just go to Project Options -> Application and load yours or use default icon.
I change the icon in 'Project Option'-'Application'
but it does not work
so I change line in project file as
{$R *.res} to {$R .res}
but it does not work neither.
Your comment welcome
About which icon are you talking about?
If this is the icon of executable file then it is posible that the old icon was chached by windows. If you are on windows Vista and newer pressing F5 inside the explorer window will refresh all icons from all files in that forlder. On Windows XP you might be forced to log off and relog for the file incon to be reloaded.
But if you are talking about icon that is shown on title bar of your application or on taskbar button then it truely means that Delphi isn't updating the resource file corectly.
Or perhaps you have added another resource file from which icon is tried to be read from. In this case make sure that resource files are compiled in correct order.
I am exploring with (.Res) resource file and found a useful tutorial on delphi.about.com site.
Tutorial Link:
http://delphi.about.com/od/objectpascalide/l/aa113099a.htm
Download test project:
http://delphi.about.com/library/aboutres.zip
I found out that the application icon is different in Windows explorer. The icon on Application form appears correctly (Refer to Image 2). The icon on Windows task bar appears correctly (refer to Image 3).
But The icon is wrong in Windows Explorer when i browse it (Refer to Image 1). It is not MAINICON from Res file.
Any idea what's wrong with it?
What do I need to configure to get the correct application icon with .EXE file?
Delphi XE3 Environment
Windows 7 Environment
You can download the sample project from above link
Image No (1)
Image No (2)
Image No (3)
Thanks in advance
Having no hint of which icon to display, the shell chooses the one with the lowest ID, or the first one that comes alphabetically. You have three icons in your executable: ICOFOLD, ICOOK and MAINICON. ICOFOLD is the one that is to be displayed in a shell folder.
The taskbar or the form icon are set by sending WM_SETICON messages once your program runs. Hence there's no guesswork there.
The icon in the Taskbar and Form window are accurate, since they come directly from the resources of the running process.
Windows Explorer, on the other hand, caches icons and sometimes that cache gets corrupted or out-of-sync. That is a well-known problem with Windows Explorer. It has nothing to do with your app. There are plenty of third-party tools available to repair the icon cache.
You can just run the following command to clear the icon cache:
ie4uinit.exe -ClearIconCache
For Windows 10, use:
ie4uinit.exe -show
Suppose I want to supply my own app icons in deployment (imagine I switch these depending on customer) is there any file name/storage pattern I should follow? Can I set set app icons programmatically or otherwise compile/runtime?
Or do I have to use the Delphi IDE to specify all the icon resources?
What I have done now is o have a shared folder where my project is configured to get icons from. I then in Window Explorer simply change icons/backgrounds found in folder. However, this is far from an ideal solution, but I suppose I should mention it as a possible answer.