[Code]
function InitializeSetup: Boolean;
var
Version: TWindowsVersion;
S: String;
begin
GetWindowsVersionEx(Version);
// 不接受在家庭版的 Windows 中安装
if Version.SuiteMask and VER_SUITE_PERSONAL <> 0 then
begin
SuppressibleMsgBox('这个程序不能安装于家庭版的 Windows。',
mbCriticalError, MB_OK, MB_OK);
Result := False;
Exit;
end;
// 不接受在域控制器中安装
if Version.ProductType = VER_NT_DOMAIN_CONTROLLER then
begin
SuppressibleMsgBox('这个程序不能安装于域控制器。',
mbCriticalError, MB_OK, MB_OK);
Result := False;
Exit;
end;
// 在 Windows 2000,检查 SP4
if Version.NTPlatform and
(Version.Major = 5) and
(Version.Minor = 0) and
(Version.ServicePackMajor < 4) then
begin
SuppressibleMsgBox('在 Windows 2000 运行时,必须安装 Service Pack 4。',
mbCriticalError, MB_OK, MB_OK);
Result := False;
Exit;
end;
// 在 Windows XP 中,检查 SP2
if Version.NTPlatform and
(Version.Major = 5) and
(Version.Minor = 1) and
(Version.ServicePackMajor < 2) then
begin
SuppressibleMsgBox('在 Windows XP 运行时,必须安装 Service Pack 2。',
mbCriticalError, MB_OK, MB_OK);
Result := False;
Exit;
end;
Result := True;
end;