Archive: Cancelling an install


Cancelling an install
I've implemented a CD Key check in my installer, but can't cancel out of it, by either clicking cancel or back. It seems to loop until i enter the right key.

how can you detect if the cancel key or back key was pressed?

cdcheck_begin:
!insertmacro MUI_HEADER_TEXT "$(CDKEY_TITLE)" "$(CDKEY_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "CDKey"

InstallOptions::dialog "$PLUGINSDIR\CDKey.ini"
Pop $R0
StrCmp $R0 "back" cdcheck_end ;if user presses back
StrCmp $R0 "cancel" cdcheck_end ;if user presses cancel

->cd key check stuff in here....

StrCmp $1 "0" cdcheck_end

#if wrong serial number
MessageBox MB_OK|MB_ICONEXCLAMATION "CD Key incorrect!" IDOK invalid

invalid:
GOTO cdcheck_begin

cdcheck_end:



what am i doing wrong?

thanks,

james


You should use the leave function of the custom page to check the cd key. That way it will not be checked if cancel/back button is pressed. You might need to update your version of NSIS to be able to use the leave function as it is a fairly new feature.

Vytautas


Yeah, try to update to the newest development snapshot, it will works.

(change the:

InstallOptions::dialog "$PLUGINSDIR\CDKey.ini"

to

!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "CDKey.ini"

have a better look!)


If you put it in the leave function, there is no need to use the return value, you can use MUI_INSTALLOPTIONS_DISPLAY.


Joost, I'm not sure what you mean. What do I put in the leave function? Is there any documentation on the leave function or any examples that I could look at?

thanks


He means you should use the page's leave function and not use the return value of InstallOptions ("back", "cancel" or "success" on the stack). The leave function for custom pages is available only in the latest CVS version. An example can be found in Contrib\InstallOptions\test.nsi.


I get it.... thanks!