Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
810 views
in Technique[技术] by (71.8m points)

delphi - Some XE2 Programs Don't Show new executable Icons In Windows Explorer

I have several programs written in Delphi XE2 that were converted from Delphi 2005, which under Windows 7 would display horribly scaled icons when shortcuts were made on the Desktop.

Using IcoFX, I created a new icon containing the usual 4 sizes (256, 48, 32, 16) and went through my programs, going to the Appearance tab for each and loading the new icon.

After rebuilding them all, I switch Windows Explorer to Large Icons view and take a look at the programs in the Bin folder, but I found that only some of them show the new 256px icon. The others still show the smaller 48px one.

I've checked the Project options again, and they all seem to be the same, so I used Resource Hacker to look at the EXE's. All of them contain 4 icons, named 1, 2, 3, 4, of differing sizes, and they all contain an Icon Group with a MAINICON resource that includes all 4 sizes.

So I'm at a loss as to why some show Large Icons correctly while others don't. Anyone have any thoughts on this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It sounds like you're experiencing Windows caching your icons. All executable files get their icons cached by Windows the first time they're shown, and thus if you change your icon, Windows will still display the old one because it's cached.

You should clear your icon cache. To do this, you need to delete a file which is in a hidden system folder, found at this location:

C:UsersUser-NameAppDataLocalIconCache.db

Replace "User-Name" with the folder name of your user profile folder. Once you have deleted this, you must log off and back on, or kill / restart the explorer.exe process. After you do this, everything should show correctly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...