uses
System.StrUtils, System.Types
function TFrmMain.CheckVersion(Ver1, Ver2: string): Boolean; //Ver1 网络版本, Ver2 本地版本
var
v1, v2: TStringDynArray;
begin
//版本判断
v1 := SplitString(Ver1, '.');
v2 := SplitString(Ver2, '.');
if (Length(v1) <> 4) or (Length(v2) <> 4) then
begin
Application.MessageBox('版本号错误,无法保证系统更新。', '版本号错误', MB_OK + MB_ICONSTOP);
end
else
begin
if v1[0] > v2[0] then
begin
Result := True;
exit
end
else if v1[1] > v2[1] then
begin
Result := True;
exit
end
else if v1[2] > v2[2] then
begin
Result := True;
exit
end
else if v1[3] > v2[3] then
begin
Result := True;
exit
end
else
begin
//版本已是最新
Result := False;
end;
end;
end;