Noitidart
Noitidart

Reputation: 37228

Refresh IconCache.db programmatically

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.

Upvotes: 2

Views: 1532

Answers (1)

Denis Anisimov
Denis Anisimov

Reputation: 3317

Try this:

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil)

Or you could try this:

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

Upvotes: 4

Related Questions