Archive: CreateShortcut Problem with Icon


CreateShortcut Problem with Icon
I'm trying to associate a custom icon to my application via CreateShortcut:



!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install-nsis.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall-nsis.ico"

LogText "> creating $SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk ..."
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "${MUI_UNICON}"

LogText "> creating $SMPROGRAMS\$STARTMENU_FOLDER\${WfestAppName}.lnk ..."
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${WfestAppName}.lnk" \
"$ACCESS_DIR\MSACCESS.EXE" '"$R0\${WfestAppFileName}" /wrkgrp "$R1"' "$INSTDIR\Images\WF_72x72_2.ico"


The problem is that the Uninstall link under Start > Programs > (my program folder) ends up with the application's icon, not the intended 'X' icon in MUI_UNICON (I added the info to specifically set the MUI_UNICON above but that didn't help).

Any ideas on what's going on here? I'm installing on a Win7 Pro 64-bit machine (BTW, the actual uninstall.exe file in my INSTDIR has the right icon).

Well, that's weird - tried it a few more times after restarting the box and all works fine now.


You cannot set the uninstall icon to ${MUI_UNICON}, as the latter only exists at compiletime. Just set the icon field to uninstall.exe.


Thanks MSG. I only added it because it seemed like the only way to get the uninstall icon back.

So, another weird compiler problem which I think now is the same as this - even after updating the script, the installer 'seems' to use a previous version's info (could the extraction of the setup.exe be cached on my Windows 7 box?). On the machine I usually develop NSIS scripts on, this change to the script:


!define: "MUI_STARTMENUPAGE_DEFAULTFOLDER"="WonderFest Model Contest"


works as expected on that WinXP box. But when I run the setup.exe on another Win7 machine, it seems to use the previous value:

Attachment 50271

This is the same behaviour I saw with the uninstaller icon - I had changed it to a custom one but then decided to go back to the MUI orang one, but it was still showing my custom icon on this machine (which is why I tried putting in the ${MUI_UNICON} bit). I think if I reboot the Win7 box all is well.

Anyone ever come across this?

Perhaps you stored the start menu folder location in registry during a previous install?


That's true, but the uninstall section removes those registry settings. And the icon for the uninstaller wouldn't be in the registry.

I'll look to see if the registry really is cleaned up after uninstall.