Analitcs

Pesquisar no conteúdo do blog.atlabs.com.br

sexta-feira, 10 de junho de 2016

DELPHI - Versão do Windows - GetWindowVersion

Reações: 
Retirado de: http://stackoverflow.com/questions/8144599/getting-the-windows-version

No XE2 ou superior:

var
  AOSVersion : TOSVersion;
begin
  ShowMessage(AOSVersion.Name);
end;




26 down vote accepted
On XE2 a new class was introduced to deal with this: TOSVersion.
  • Read TOSVersion.Architecture to check for 32 or 64 bit OS.
  • Read TOSVersion.Platform to check for Windows or Mac.
  • Read TOSVersion.Major and TOSVersion.Minor for version numbers.
  • Read TOSVersion.Name to obtain the basic product name, e.g. Windows 7.
  • Read TOSVersion.ToString to obtain the full product name with version, e.g. Windows 7 Service Pack 1 (Version 6.1, Build 7601, 64-bit Edition).

For older versions of Delphi I recommend the following:
In order to check for 2000, XP, Vista, 7 I suggest you read Win32MajorVersion and Win32MinorVersion.
  • major.minor = 5.0 => Windows 2000
  • major.minor = 5.1 => Windows XP
  • major.minor = 5.2 => Windows 2003 server or XP64
  • major.minor = 6.0 => Windows Vista/2008 server
  • major.minor = 6.1 => Windows 7/2008 server R2

Max Gehringer