I really liked the oxygen appearance of KDE SC 4. I wrote a program to apply these icons to windows. The program is written in NSIS, and is currently nearly fully functional. However, the only way I found to make Windows aware of the icon changes is to kill explorer.exe, delete the icon cache, and respawn explorer.exe. SHChangeNotify
with SHCNE_ASSOCCHANGED
seems to be unable to make Windows aware of the changes to the Control Panel icon, the My Computer icon, etc. Please suggest a better, less brutal approach to make Windows aware of these changes.
EDIT: I found a program called Icon Tweaker that appears to be able to do this, but it is closed source and so I have no idea how it does this. (IconTweaker: http://www.crystalxp.net/galerie/en.id.83-icontweaker.html)
EDIT: I have this working fine, thanks to Anders' reply (see below). However, I'll just put my working NSIS code here,in case someone else needs it
ReadRegStr $0 HKCU "Control Panel\Desktop\WindowMetrics" "Shell Icon Size"
IntOp $0 $0 + 1
WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "Shell Icon Size" $0
SendMessage 0xffff 0x001A 42 0 /TIMEOUT=100000
IntOp $0 $0 - 1
WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "Shell Icon Size" $0
SendMessage 0xffff 0x001A 42 0 /TIMEOUT=100000
The $0 register is used to store the Shell Icon Size
value of HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
. We then increment the value and do a SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0, SMTO_ABORTIFHUNG, 100000, NULL)
, followed by a decrement and re-send.
EDIT: As a bonus, this can be used as a hack to get larger (Windows 7 size) desktop icons on Windows XP. Just double the Shell Icon Size
value and call SendMessage
(don't perform the second change that restores the size)