I change the default system folder icon via registry key
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons', True);
Reg.WriteString('3', 'C:\MyIcon.icl,0');
finally
RegFile.Free;
end;
I can change registry values, but the problem is I need to restart the OS for it to take effect.
To fix it I tried:
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);
and:
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
It works on WinXP but does not on Win7.
How can i fix it on Win7?