Refresh IconCache.db programmatically

孤街浪徒 提交于 2019-12-23 03:48:09

问题


I have a button for firefox.exe pinned. I changed the pinned icon via registry I set the path to a url:

  1. I added firefox.exe folder to HKEY_LOCAL_MACHINE: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\ and set it's value to C:\Users\myUsername\Downloads\addon.ico
  2. I added firefox.exe folder to HKEY_CURRENT_USER: HKEY_CURRENT_USER\SOFTWARE\Classes\Applications\ and set it's value to C:\Users\myUsername\Downloads\addon.ico

The icon at that path definitely exists.

However even though my icon is pinned for it doesn't take. I'm guessing I have to refresh the IconCache.db can you please recommend a way to do this with win api? Without restarting computer or program or logging off computer please is my hope.


回答1:


Try this:

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil)

Or you could try this:

SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH, 'YourPinnedFileName', nil)


来源:https://stackoverflow.com/questions/24322396/refresh-iconcache-db-programmatically

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