Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong EXE Application Icon with Resource files

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)

EXE Application icon is wrong in Windows Explorer

Image No (2)

Application icon appears correctly on the task bar

Image No (3)

Application icon appears correctly on the form

Thanks in advance

like image 389
sMah Avatar asked May 13 '14 00:05

sMah


2 Answers

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.

like image 149
Sertac Akyuz Avatar answered Oct 17 '22 00:10

Sertac Akyuz


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.

like image 33
Remy Lebeau Avatar answered Oct 17 '22 00:10

Remy Lebeau