[Inno/Code] Check Windows Version...

Inno Setup Discussion
Post Reply
User avatar
-=[4lfre1re]=-
Posts: 192
Joined: Sun Jan 10, 2016 10:38 am

[Inno/Code] Check Windows Version...

Post by -=[4lfre1re]=- » Tue Feb 23, 2016 4:05 pm

[Inno/Code] Check Windows Version...

To check Windows Version and Achitecture, use this code:

Code: Select all

[/b]
function [color=#FF0000]IsWin2k[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major >= 5) and Not IsWin64;
end;

function [color=#FF0000]IsWinXP[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major < 6) and Not IsWin64;
end;

function [color=#FF0000]IsWinXP64[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major < 6) and IsWin64;
end;

function [color=#FF0000]IsVista[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 0) and Not IsWin64;
end;

function [color=#FF0000]IsVista64[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 0) and IsWin64;
end;

function [color=#FF0000]IsWin7[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 1) and Not IsWin64;
end;

function [color=#FF0000]IsWin764[/color]: Boolean;
var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 1) and IsWin64;
end;

function [color=#FF0000]IsWin8[/color]: Boolean;

var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 2) and Not IsWin64;
end;

function [color=#FF0000]IsWin864[/color]: Boolean;

var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 2) and IsWin64;
end;

function [color=#FF0000]IsWin81[/color]: Boolean;

var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 3) and Not IsWin64;
end;

function [color=#FF0000]IsWin8164[/color]: Boolean;

var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 6) and (ver.Minor >= 3) and IsWin64;
end;

function [color=#FF0000]IsWin10[/color]: Boolean;

var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 10) and (ver.Minor >= 0) and Not IsWin64;
end;

function [color=#FF0000]IsWin1064[/color]: Boolean;

var
  ver: TWindowsVersion;
begin
  GetWindowsVersionEx(ver);
  Result := UsingWinNT and (ver.Major = 10) and (ver.Minor >= 0) and IsWin64;
end;[/quote]

[b]Use example:[/b]
[quote][b][Run][/b]
Filename: "{tmp}\custom.cmd"; Flags: runhidden; [color=#FF0000]Check: IsWin764[/color][/quote]

Cheers... ;-)
Image

Post Reply