inbox4sumit
29th June 2007 20:13 UTC
Uninstaller Help
Hello
Inside .onInit function, I check if a previous version exists. If it does then I call the uninstaller using ExecWait. Something like below:
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to
remove this version or `Cancel` to abort."\
ID_OK uninst
Abort
uninst:
ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR'
; Continue with Installation Steps
:
:
The problem is that since I'm NOT running the ExecWait in silent-mode and the user can press "Cancel" instead of "Uninstall", when the uninstall confirm page (MUI_UNPAGE_CONFIRM) shows up. The uninstaller will exit and I'll still move onto my installation steps. How do I catch "Cancel" so that I can abort the installation?
Thanks
kichik
29th June 2007 20:16 UTC
Pass a variable to ExecWait and it'll return the error level of the uninstaller. If it's not zero, the uninstaller failed.
ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR' $0
For more on error levels, see the documentation.
http://nsis.sourceforge.net/Docs/AppendixD.html#D.1inbox4sumit
29th June 2007 20:17 UTC
I did that, but I don't get anything back. Do I have to have some code in my uninstaller to send return code?
kichik
29th June 2007 20:19 UTC
No. If the return code is zero, the user didn't hit the Cancel button. As the linked documentation says, it'll return 1 if the user hit the Cancel button.
inbox4sumit
29th June 2007 20:22 UTC
Thanks for your help. Tried again. It worked this time. Must be doing soemthing wrong earlier when referencing the return value.
Thanks