views:

1716

answers:

2

I'm trying to customize the icon that shows in Windows Explorer and in Desktop shortcuts for my Delphi application.

In the Delphi 7 IDE, I have loaded the desired icon in the Application tab of the Project Options dialog. It shows my desired icon as a graphic.

I didn't think it was necessary, but I also set my icon as the TMainForm Icon property.

However, the resulting EXE still shows the default D7 icon. What am I missing?

+1  A: 

Maybe the icon cache needs to be deleted. There are many pages about this problem, this link might be useful: http://smallvoid.com/article/windows-icon-cache.html

mjustin
+3  A: 

I found it after more hunting. I created a new project by copying an existing project from another folder. I forgot to change the program name at the top of the DPR file to match the name of the new project. Somehow, if a wrong name is used there, it prevents the icon from being changed in the generated EXE file...

tim11g
The app's icon is stored in the .res file, as an icon resource named MAINICON. Also, if you find the answer to your own question, consider deleting the question.
Stijn Sanders
@Stijn: No, he shouldn't. The answer may be useful to someone else in the future. Answering your own questions is covered in the SO FAQ - perhaps you should read it.
Ken White
@tim11g: could you edit your answer to be more explicit regarding what you learned was the problem, and how it can be fixed (without creating a new project)? As is, this answer is not clear. +1 to Ken - questions and CLEAR answers need to be retained.
Argalatyr
@Argalatyr: I'm not sure exactly how or why it affects the ability to set the icon, but the issue was the Program name in the .DPR file. Since I copied the project from a similar project, the old project name was at the top of the DPR. The project filename has been changed to NewProject.DPR, but inside NewProject.DPR, the first line was "program OldProject;". That inconsistency seems to break something. Fixing it is as simple as opening the DPR file and changing the line "program OldProject;" to be "program NewProject;"
tim11g