Reputation: 31
I was trying to customize a folder. Mainly to control the folder icon. This was achieved when desktop.ini file was created within that folder with my custom settings. Now I would want to customize the folder without doing any change(add/ remove) in that folder. How can I achieve this?
Any help would be great. Thanks in advance.
Upvotes: 1
Views: 1061
Reputation: 31
Actually this could be done without inifile. It just that we have to implement a Shell Icon Overlay Handler, a COM object which implements the IShellIconOverlayIdentifier interface. This document helped a lot. http://www.codeproject.com/Articles/7484/How-to-overlay-an-icon-over-existing-shell-objects
Upvotes: 1
Reputation: 2936
I think there is no way to do this but you can do this to hide desktop.ini file even if displays hidden files.
StreamWriter sw = new StreamWriter(iniFile);
sw.WriteLine("[.ShellClassInfo]");
sw.WriteLine("IconResource=.\\" + iconPath + ",0");
sw.Close();
File.SetAttributes(filePath, File.GetAttributes(filePath) | FileAttributes.Hidden | FileAttributes.System);
File.SetAttributes(folderPath, File.GetAttributes(folderPath) | FileAttributes.ReadOnly);
I don't remember if last line is necessary because I wrote this code more than one year ago.
Upvotes: 3