问题
I have a button for firefox.exe pinned. I changed the pinned icon via registry I set the path to a url:
- I added
firefox.exe
folder to HKEY_LOCAL_MACHINE:HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\
and set it's value toC:\Users\myUsername\Downloads\addon.ico
- I added
firefox.exe
folder to HKEY_CURRENT_USER:HKEY_CURRENT_USER\SOFTWARE\Classes\Applications\
and set it's value toC:\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