Alteração do ícone da pasta
Estou alterando os ícones de pasta com a função c #. Está funcionando bem, mas o problema está funcionando pela primeira vez. Quero dizer, não consigo alterar o ícone da pasta para a qual já mudei o ícone. Aqui está o código abaixo:
static void Main(string[] args)
{
LPSHFOLDERCUSTOMSETTINGS FolderSettings = new LPSHFOLDERCUSTOMSETTINGS();
FolderSettings.dwMask = 0x10;
FolderSettings.pszIconFile = @"C:\Program Files (x86)\Common Files\TortoiseOverlays\icons\XPStyle\ModifiedIcon.ico";
FolderSettings.iIconIndex = 0;
UInt32 FCS_READ = 0x00000001;
UInt32 FCS_FORCEWRITE = 0x00000002;
UInt32 FCS_WRITE = FCS_READ | FCS_FORCEWRITE;
string pszPath = @"D:\Downloaded Data";
UInt32 HRESULT = SHGetSetFolderCustomSettings(ref FolderSettings, pszPath, FCS_WRITE);
//Console.WriteLine(HRESULT.ToString("x"));
//Console.ReadLine();
}
[DllImport("Shell32.dll", CharSet = CharSet.Auto)]
static extern UInt32 SHGetSetFolderCustomSettings(ref LPSHFOLDERCUSTOMSETTINGS pfcs, string pszPath, UInt32 dwReadWrite);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
struct LPSHFOLDERCUSTOMSETTINGS
{
public UInt32 dwSize;
public UInt32 dwMask;
public IntPtr pvid;
public string pszWebViewTemplate;
public UInt32 cchWebViewTemplate;
public string pszWebViewTemplateVersion;
public string pszInfoTip;
public UInt32 cchInfoTip;
public IntPtr pclsid;
public UInt32 dwFlags;
public string pszIconFile;
public UInt32 cchIconFile;
public int iIconIndex;
public string pszLogo;
public UInt32 cchLogo;
}
Qual seria a razão