Is there any possibility to change the Icon

110 Views Asked by At

For My current works I need to Mark some Files and folders as uploaded and rest are not yet uploaded, I wish to change the File/Folder or some overlay images to achieve the goal. I've changed the Folder Icon as expected by using the following code:

 public static void ChangeFolderIcon(string folderPath, string iconPath)
 {
     if (File.Exists(folderPath + @"\desktop.ini"))
     {
         File.Delete(folderPath + @"\desktop.ini");
     }
     StreamWriter sWritter = File.CreateText(folderPath + @"\desktop.ini");
     sWritter.WriteLine("[.ShellClassInfo]");         
     sWritter.WriteLine("IconFile=" + iconPath);
     sWritter.WriteLine("IconIndex=0");
     sWritter.Close();
     sWritter.Dispose();
     File.SetAttributes(folderPath + @"\desktop.ini", File.GetAttributes(folderPath + @"\desktop.ini") | FileAttributes.Hidden);
     File.SetAttributes(folderPath, File.GetAttributes(folderPath) | FileAttributes.System);
 }

I had Tried some solutions(1,2 etc.) but nothing help me to change the file icon, or overlay the file icon. Is there any possibility to do this in c# or by referring some c++ libraries to the C#.

Please note : I'm not using any UI, The complete process is done through Console Application.

0

There are 0 best solutions below