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.
Related
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 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
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.
I want to add icon to my delphi app. Icon was generated from image via ICOFX, including 128x128 and 256x256 (Vista) icons. I tried to add icon several times:
First of all, using Code Gear IDE: Project Options->Application->Icon. This was an easy way, but Vista-sized icons (128x128 and 256x256) were not added. When scaling in Windows Explorer Ctrl+Wheel, icon stoped increasing in size after 64x64. This happens because Delphi does not support big icons.
Then I tried to change icon in MyProject.RES file (using ResourseExplorer). It did not helped much.
When changing .exe-file icon using ResourseExplorer problems seems to be solved, but this is not a Path of a jedi, obviously. And some problems appears/remains, such as:
when changing .exe-file name (ex: from MEPROG.EXE to _MYPROG.EXE), file icon is changing either (128x128 and 256x256 icons disappeare).
when using MouseRightButton->Send to->Desktop to create a label, label's icon is of small resolution.
copy-pasting exe-file into some other directory(not in deplhi project output dir), could also change icon.
Is there a better way to do this, or I am doing this wrong way?
The Delphi 2007 IDE cannot handle large Vista icons, which use PNG compression. And neither can the brcc32 resource compiler that ships with Delphi 2007.
My solution, when I was still using legacy Delphi versions, was to make a .rc file containing the icons, and compile using the MS resource compiler, rc. The MS resource compiler does support such icons, and is readily available, for example with the Windows SDK.
See the change-log around 2.7 version
http://andy.jgknet.de/blog/ide-tools/ide-fix-pack/
it seems you just try to use Delphi without installing necessary fixes
PS. another way might be to make some command-line utility replacing icon resource and then auto-call it after compilation phase. Still ugly, but better than manually launchign ResEdit each time.
If you do not see the icon, 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.