Using Resource Hacker for changing the icon after the build

半腔热情 提交于 2019-12-03 12:10:29

问题


This question is written in several places (like here and here).

In the second question there is a comment that says to use

ResHacker.exe -addoverwrite "Project.exe", "Project.exe", "ProgramIcon.ico", ICONGROUP, MAINICON, 0

I also tried using -modify instead of -addoverwrite

ResHacker.exe -modify "Project.exe", "Project.exe", "ProgramIcon.ico", ICONGROUP, MAINICON, 0

but the result is the same.

The icon is changed: if I right click on the exe file and check the properties I see that the icon has been changed, but in Windows Explorer I still see the old icon.

If I open it with Resource Hacker (so not using it as command line tool, but as normal GUI tool) I see the correct icon in the "Open file" dialog.

Can anybody suggest a solution? I am trying to use this in a Delphi post build event.


回答1:


I suspect that you are seeing the icon from explorer's icon cache.




回答2:


David's right, Explorer's icon cache needs updating.

Add the following command to your batch file after your ResHacker command:

ie4uinit.exe -ClearIconCache

(ie4unit is a built-in command)

No need to restart explorer.



来源:https://stackoverflow.com/questions/5165594/using-resource-hacker-for-changing-the-icon-after-the-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!