Archive: Serial number custom page


Serial number custom page
  Hi everyone,

I discovered this program today, and am quite impressed. It seems able to do everything I require, but I'm having a little difficulty with one thing.

Basically, I want to use a custom page where the user enters his serial number, and install the appropriate options based on that. It's not really a copy protection scheme (the user still needs to activate the product), more of a way to incorporate everything in one installation package.

Here's an example of the function I'm using (I'll put a dll call in later, just a StrCmp for now...):


SerialPage


loop:
!
insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "serial.ini"

ReadINIStr $INI_VALUE "$PLUGINSDIR\serial.ini" "Field 2" "State"
StrCmp $INI_VALUE "07" exit
WriteINIStr "$PLUGINSDIR\serial.ini" "Field 2" "State" ""
>goto loop

>exit:
>FunctionEnd
>
It works, in so far as if the user does not enter "07" (in this example) in the text control I placed, the page will clear the serial and reload the page (dialogs etc to be added).

My problem occurs when the user clicks the "Cancel" button. The installer will only quit when a valid serial number has been entered. Is there another way to do this? Can I trap the Cancel button? I've hit a bit of a blank.

Thanks in advance

Pete.

think, the solution is also posted in various readmes.
the thing is, to check, WHICH button is pressed.
you'll do this with the following code:

!insertmacro MUI_INSTALLOPTIONS_READ $0 "serial.ini" "Settings" "State"
StrCmp $0 "1" +2
Return
...


also, you should NOT use the code you currently do have.

have a look at the install options readme and the official docs and read the sections about custom pages, the leave function and abort calls there!!