Reputation: 87
So I'm trying to create an installer with a serial number verification in Inno Setup 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 Inno Setup code all that much, but can anyone explain how to make this work please? Thanks!
Upvotes: 3
Views: 1110
Reputation: 76713
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 multliple 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;
Upvotes: 4