Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi - Icon of compiled EXE is wrong and cannot be changed

I'm having this strange issue for the first time in my 15+ experience of using Delphi. This is the icon I set in the project options (XE4): enter image description here

And this is the resulting application icon after compiled:

enter image description here

I've no idea where does that icon come from and I have no way to change the icon (really driving me crazy).

The icon of this project has been ok for over a year until later today. Things I've tried with no luck:

  • Use the 'Load Icon...' button to change it to another complete different icon and re-build.
  • Use the 'Default' button to reset to default icon and re-build.
  • Deleted project1.res file and re-build.
  • Deleted the .dproj file, open .dpr file instead and let the Delphi IDE created a blank new .dproj file. no luck.
  • I thought it's the Windows 7's IconCache.db file corrupted, deleted that file and restarted Windows, no help. Actually I used Resource Hacker to confirmed it's not the Windows Explorer displaying the wrong icon but it's the icon resource in the EXE is wrong... too strange.
  • restored the .dproj file from SVN to yesterday(the icon was ok yesterday)'s revision and no luck.

Anything else do you suggest me to try? Thank you!

like image 509
Edwin Yip Avatar asked Aug 17 '19 17:08

Edwin Yip


1 Answers

Review the line in your main form with {$R *.res}. I had the same issue and it was that this line was accidentally deleted. That caused that icon and other resouces to not be correct in the final executable, like version number, icons etc.

If you don't know what that line is, simply make a few empty new vcl application and search it in the main form.

like image 108
Diego Muñoz Avatar answered Sep 28 '22 00:09

Diego Muñoz