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 $05000893 on Windows 2000, which is version 5.0.2195.

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 IsWindowsXPOrLater: Boolean;
begin
  Result := (GetWindowsVersion >= $05010000);
end;
See also:

GetWindowsVersionEx