Pascal Scripting: GetWindowsVersion

Prototype

function GetWindowsVersion: Cardinal;

Description

Returns the version number of Windows packed into a single integer. The upper 8 bits specify the major version; the following 8 bits specify the minor version; the lower 16 bits specify the build number. For example, this function will return $0A002800 on Windows 10 Version 1507, which is version 10.0.10240.

To retrieve just the major version number, use: GetWindowsVersion shr 24. To retrieve just the minor version number, use: (GetWindowsVersion shr 16) and $FF. To retrieve just the build number, use: GetWindowsVersion and $FFFF.

Example:
function IsWindows8OrLater: Boolean;
begin
  Result := (GetWindowsVersion >= $06020000);
end;

See also

GetWindowsVersionEx