Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET: How Do I Create File Icon Overlays

I'm trying to add different icon overlays over the icons of various files (note: not all the files of a certain type, just certain files). If you don't get what I mean, I'm referring to what programs like TortoiseSVN, TortoiseHG, Dropbox, etc. do.

Can this be done in .NET? If so, how? I'm hoping there's a library out there for this. I found this CodeProject article about something like this, but it's not .NET.

Thanks in advance.

like image 585
Maxim Zaslavsky Avatar asked Mar 22 '10 23:03

Maxim Zaslavsky


1 Answers

No, it's not .NET. Shell programming is in the domain of unmanaged C/C++. Shell32.dll has a type library that makes some functions available to scripting languages and .NET. But the IShellIconOverlay interface inherits from IUnknown, not accessible to scripting. It is technically possible but you'll have to redeclare the interface in C#, using the declaration in the SDK's ShlObj.h header file as a template. Somebody has done it somewhere, probably, but it is uncommon to try to make it work. A quick Google search turns up nothing useful.

Hopefully, .NET 4.0 will revive some activity, solving the CLR version injection problem. I haven't yet seen a sign of it.

like image 140
Hans Passant Avatar answered Oct 25 '22 23:10

Hans Passant