[python-win32] shell.SHChangeNotify failed to refresh icons
Mark Hammond
mhammond at skippinet.com.au
Sat Feb 16 00:34:23 CET 2008
> I tried passing SHCNE_UPDATEDIR to the parent dir of the icons, but
> the icons were not refreshed. Win32traceutil also didn't record any
> overlay icons requests. Here's how it was done:
>
> dir = os.path.dirname(path)
> pidl, ignore = shell.SHILCreateFromPath(dir, 0)
> print "notify: ", shell.SHGetPathFromIDList(pidl)
> shell.SHChangeNotify(shellcon.SHCNE_UPDATEDIR,
> shellcon.SHCNF_IDLIST | shellcon.SHCNF_FLUSH,
> pidl,
> None)
>
> Any thing I did wrong?
Not that I can see - but you are relying on the behaviour of Explorer's SHChangeNotify handler, and I've no idea how that is implemented - but I wouldn't be surprised to find that an SHCNE_UPDATEDIR is *not* treated as a full refresh, even if that does leave the possibility that icons or other attributes will be slightly out of date - they will correct themselves after a refresh after all.
In other words, just because the shell may collapse many SHCNE_UPDATEITEM calls into a single SHCNE_UPDATEDIR notification, there is no requirement that notification handlers treat SHCNE_UPDATEDIR as performing a complete SHCNE_UPDATEITEM for every item in the directory.
Cheers,
Mark
More information about the python-win32
mailing list