问题描述:

So I'm trying to create an installer with a serial number verification in InnoSetup using this:

CustomPage for Serial Number in Inno Setup

^For the serial number page

How can i set the serial for this serial form (Inno Setup)

^For the checking of the serial entered. Both are made by TLama!

So I'm trying to make the code use multiple serial numbers, I tried doing this (using the code from the second link):

CanContinue := GetSerialNumber('-') = '62FFU-GA4N8-T8N6W-WLQJW-N6WLQ-AJKD6';

CanContinue := GetSerialNumber('-') = 'TEST1-RANDO-MFAKE-THING-YBLAB-BLA55';

but when doing that, only the second one will work.

I don't really understand the InnoSetup code all that much, but can anyone explain how to make this work please? Thanks!

网友答案:

It didn't work as expected because you were overwriting the CanContinue value by the second line of code which led to work only for the second serial number.

You should store the returned value of the GetSerialNumber function to some local variable to avoid multiple function calls and use the or operator in the statement. Something like this (I've also removed the extra CanContinue variable, which was not much useful here):

procedure OnSerialEditChange(Sender: TObject);
var
  S: string;
begin
  // store the returned value to the local variable to avoid mutliple calls
  S := GetSerialNumber('-');
  // enable the NextButton only when the serial number matches either first
  // OR the second serial number string
  WizardForm.NextButton.Enabled := (S = '62FFU-GA4N8-T8N6W-WLQJW-N6WLQ-AJKD6') or
    (S = 'TEST1-RANDO-MFAKE-THING-YBLAB-BLA55');
end;
相关阅读:
Top