Refresh shell icons

From NSIS Wiki
Jump to navigationJump to search
Author: jerometremblay (talk, contrib)


How To Use

After changing file associations, you can call this macro to refresh the shell immediatly. It calls the shell32 function SHChangeNotify. This will force windows to reload your changes from the registry.

Call RefreshShellIcons

Note: If you are creating a desktop shortcut to your application, using an ICO icon file inside your application folder, and you change the icon design some time later, Windows will not refresh the desktop shortcut on subsequent installation of your updated application - not even after a reboot. Using the "Refresh shell icons" trick (mentioned elsewhere) also does not work. I've found you have to rename the ICO file in the application folder (e.g. from "appicon.ico" to "appicon2.ico") to force a refresh. --84.9.61.137 06:11, 18 April 2006 (PDT) Steve S

The Function

!define SHCNE_ASSOCCHANGED 0x08000000
!define SHCNF_IDLIST 0
 
Function RefreshShellIcons
  ; By jerome tremblay - april 2003
  System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v \
  (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
FunctionEnd