Skip to content
⌘ NSIS Forum Archive

Actualize the Icon Classes_Root in Registry

10 posts

Defcon0#

Actualize the Icon Classes_Root in Registry

Hello,

in my installer I set some icons and descriptions for 2 types of files .mzt and .mzt2. For this I write the key .mzt in the HKEY_CLASSES_ROOT dir in the registry.
This works just fine. But only after a reboot.
With InstallShield which I used before the (much better 🙂) NSIS the icons were instantly connected with the file types.

Is this also possible with NSIS ?

Thanks.

Bye Defcon0
Defcon0#
Oh it doesn't work, I see now:
[...]
Processed 1 file, writing output:
Adding plug-ins initializing function... Done!
Error: resolving install function "RefreshShellIcons" in install section "Zusätzliche Dateien" (1)
Note: uninstall functions must begin with "un.", and install functions must not
Error - aborting creation process
Defcon0#
No, I think this not the point.
I don't use this for uninstall. In the documentation is written:
Syntax:

${RefreshShellIcons}
Example:

Section
WriteRegStr HKCR "Winamp.File\DefaultIcon" "" "$PROGRAMFILES\Winamp\WINAMP.EXE,2"

${RefreshShellIcons}
SectionEnd
But when I type it in (means ${RefreshShellIcons}) there's the error:
Invalid command: ${RefreshShellIcons}
Error in script "C:\Documents and Settings\Administrator\Desktop\Setup\Setup.nsi" on line 164 -- aborting creation process
kichik#
That's a totally different error and function than the last one. Of course it's not the point.

To use the last RefreshShellIcons you mentioned, you must first include the appropriate header file - FileFuncs.nsh, and then insert the function macro. Only then you can use the function. If you wish to use it in the uninstaller, insert the macro prefixed with "un." and use accordingly.
Defcon0#
ok. I included the FileFunc.nsh.
.. and then insert the function macro
How do I do it ? Sorry I'm really new to NSIS.
Is it !insertmacro ... ? If so, what's "..." ?
kichik#
It's all in the documentation.
!include FileFuncs.nsh
!insertmacro RefreshShellIcons
!insertmacro un.RefreshShellIcons

Section something
${RefreshShellIcons}
SectionEnd

Section uninstall
${un.RefreshShellIcons}
SectionEnd