Add status icons over file icons in Explorer, like Dropbox or SVN in .NET
For anyone still interessted in this question:
Here is a codeproject link which describes the process in great detail.
It uses the SharpShell library, which can also be found on nuget.
Code, from the codeproject, looks something like that:
[ComVisible(true)]
public class ReadOnlyFileIconOverlayHandler : SharpIconOverlayHandler
{
protected override int GetPriority()
{
// The read only icon overlay is very low priority.
return 90;
}
protected override bool CanShowOverlay(string path, FILE_ATTRIBUTE attributes)
{
try
{
// Get the file attributes.
var fileAttributes = new FileInfo(path);
// Return true if the file is read only, meaning we'll show the overlay.
return fileAttributes.IsReadOnly;
}
catch (Exception) { return false; }
}
protected override System.Drawing.Icon GetOverlayIcon()
{
// Return the read only icon.
return Properties.Resources.ReadOnly;
}
}
I've never play with this, but I think it's the right way.
Custom Folder
First make the folder a System Folder, then create a Desktop.ini file and apply the change inside.
[.ShellClassInfo]
[email protected],-12690
IconFile=%SystemRoot%\system32\SHELL32.dll
IconIndex=-238
You should develop an overlay icon handler and register it into the system.
Here you can find a partially working example written in C#.
Some MSDN documentation here and here.