Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top