I need a method to create Icon Overlay's for Folders and Files in Windows XP/Vista, using C# or C++? Any examples?
Thanks, -Sean!
Do not do this! Please, please don't.
You will break a lot of applications. Shell extensions must not use the .net framework (or any other similar framework), ever.
Here's an explanation why you must not do this.
Write your extension in C/C++, but not C#.
Update: Even though as of .NET4 it's possible to have multiple framework versions in one process, it is still not recommended and not supported by Microsoft! See this post about why:
[...] These problems led us to officially recommend against—and not support—the development of in-process shell extensions using managed code.
Tigris' TortoiseSVN product heavily uses icon overlays provided by library shared by several Tortoise products, the overlays themselves are written in C++ rather than C#.
The documentation for the TortoiseOverlays project explains how they use it and the problems they have encountered (username: guest, empty password), and the GPL'ed sourcecode is in the Subversion repository (same username/password as above).
Snippit from documentation:
TortoiseOverlays registers itself with the explorer to handle the nine states mentioned above, i.e. it registers nine overlay handlers. The explorer process initializes the TortoiseOverlays handler, calling its IShellIconOverlayIdentifier::GetOverlayInfo(). TortoiseOverlays looks for the registered overlay handlers under HKLM\Software\TortoiseOverlays\Statusname and calls their GetOverlayInfo() method so they can initialize too (Note that any change to the icon name, index, ... your handler does are overwritten later and won't be used - it's TortoiseOverlays that handles the icons now). After the initialization, TortoiseOverlays relays every call to its IShellIconOverlayIdentifier::IsMemberOf() method to the other handlers. The first handler that returns S_OK determines whether the icon is shown or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With