Wednesday 2 May 2018

windows 7 - How can a script add a little icon overlay on files' icons


Just like Dropbox does, I'd like to show if a file is backed up using the icon overlay. How could this be done, without human intervention and regarding a specific computer so it doesn't have to be distributable.


This question regards only how to add/change this icon small overlay, not how to check if the files are backed up.


I am aiming at Windows 7 at the moment.



Answer



If you look at the reference Icons and Icon Overlays or more specifically How to Create Icon Handlers and How to Implement Icon Overlay Handlers you will see that you need to implement a DLL/COM Component.


Said DLL needs to implement certain interfaces (IUnknown and IShellIconOverlayIdentifier as far as I can tell) and will be called by the Windows explorer process upon displaying an icon. For this to happen you need to create an entry in the registry. As you probably want that overlay to be displayed for all types of files you will probably need to register for a general file type.


Later on GetOverlayInfo will be called to register your icon and IsMemberOf to indicate whenever or not you want your overlay to be displayed.


As for identifying files or storing information about them you could use an Alternate Data Stream though that would mean it would only/mostly work for NTFS and as you said is not really part of your question.


If you look at this help article for DropBox you will see that the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers could/would also be important in order to decide which icons are going to be displayed.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...