Open arjunbalgovind opened 4 years ago
@crutkas FYI. @chrdavis might have some insights on this.
To my knowledge you can
%localappdata%\Microsoft\Windows\Explorer
iconcache.db thumbcache.db
@arjunbalgovind
We have to send the message SHChangeNotify
with the SHCNE_ASSOCCHANGED
flag.
Quote from docs.microsoft.com: "Remarks Applications that register new handlers of any type must call SHChangeNotify with the _SHCNEASSOCCHANGED flag to instruct the Shell to invalidate the icon and thumbnail cache. This will also load new icon and thumbnail handlers that have been registered. Note, however, that icon overlay handlers are not reloaded." (https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shchangenotify)
@Aaron-Junker / @davidegiacometti is this in progress?
@Aaron-Junker / @davidegiacometti is this in progress?
Not really, https://github.com/microsoft/PowerToys/pull/12996 was a partial work. Since there seems to be no way to clean thumbnails for a file extension maybe closing this for https://github.com/microsoft/PowerToys/issues/13618 could be a good choice.
Programmatically invoking the thumbnail cleanup component of the desktop cleanup wizard - which I wouldn't recommend as it is not publicly supported but people seem to be doing it
The Disk Cleanup handlers API is documented and anyone can write a custom handler.
While testing the fix for enabling/disabling the File Explorer add-ons (https://github.com/microsoft/PowerToys/pull/6883), i.e. preview handlers and thumbnail providers it was found that for thumbnail providers, if you enable/disable the setting may require restarting explorer and cleaning up the thumbnail cache. This also applies for uninstalling.
I'm not exactly sure under what circumstances does Windows normally update the thumbnail cache, but clearing the thumbnail cache using the steps in this article: https://neosmart.net/wiki/clear-thumbnails-cache/#Method_2-4, i.e.
Disk Cleanup ->Thumbnails
can be used consistently to enable/disable the handler once the setting has been applied from PowerToys. (more context at this comment https://github.com/microsoft/PowerToys/pull/6883#discussion_r501415314)We should find if this step can be avoided, or if there is a way to trigger it from code.