This will work, because there is currently only majorversion 1.0 and 1.1 and 1.2 and it will still work if version will become 1.3 or later.
So, I figured this workaround for you.
![Smile :)](./images/smilies/icon_e_smile.gif)
[Code]
function InitializeSetup(): Boolean;
var
MVCheck: string;
begin
Result := False;
RegQueryStringValue(HKEY_CURRENT_USER, 'Software\CNCdrive\UCCNC', 'MajorVersion', MVCheck)
if (MVCheck = '1.0') then begin
MsgBox('The 2017 Screenset requires UCCNC Version 1.2xx or later - Installation aborting.', mbError, MB_OK);
end
else if (MVCheck = '1.1') then begin
MsgBox('The 2017 Screenset requires UCCNC Version 1.2xx or later - Installation aborting.', mbError, MB_OK);
end
else begin
Result := True;
end
end;
[Code]
function CompareVersion(V1, V2: string): Integer;
var
P, N1, N2: Integer;
begin
Result := 0;
while (Result = 0) and ((V1 <> '') or (V2 <> '')) do
begin
P := Pos('.', V1);
if P > 0 then
begin
N1 := StrToInt(Copy(V1, 1, P - 1));
Delete(V1, 1, P);
end
else
if V1 <> '' then
begin
N1 := StrToInt(V1);
V1 := '';
end
else
begin
N1 := 0;
end;
P := Pos('.', V2);
if P > 0 then
begin
N2 := StrToInt(Copy(V2, 1, P - 1));
Delete(V2, 1, P);
end
else
if V2 <> '' then
begin
N2 := StrToInt(V2);
V2 := '';
end
else
begin
N2 := 0;
end;
if N1 < N2 then Result := -1
else
if N1 > N2 then Result := 1;
end;
end;
function InitializeSetup(): Boolean;
var
MVCheck : string;
RequiredVersion : string;
begin
RequiredVersion := '1.2'
RegQueryStringValue(HKEY_CURRENT_USER, 'Software\CNCdrive\UCCNC', 'MajorVersion', MVCheck);
if CompareVersion(MVCheck, RequiredVersion) < 0 then begin
if (MsgBox('Your version of UCCNC ' + MVCheck + ' is too old. This screen will not work prior version 1.2. Do you want to install it nonetheless?',
mbConfirmation, MB_YESNO) = IDNO) then
begin
Result := False;
Exit;
end;
end;
end;
Users browsing this forum: No registered users and 11 guests