Delphi-Help

  • Increase font size
  • Default font size
  • Decrease font size
Главная Статьи Windows Как узнать версию Windows?

Как узнать версию Windows?

Оцените материал
(2 голосов)

Как узнать версию Windows?

Способ первый

function GetWinVer: string;
var
  temp1, temp2, temp3:  integer;
  OsVer: OSVERSIONINFO;
begin
   OsVer.dwOSVersionInfoSize := SizeOf( OSVERSIONINFO );
   GetVersionEx( OsVer );
   temp1 := OsVer.dwMajorVersion;
   temp2 := OsVer.dwMinorVersion;
   temp3 := OsVer.dwPlatformId;
 
   if temp1 = 4 then
      if temp2 = 0 then
         if temp3 = VER_PLATFORM_WIN32_WINDOWS then
            Result := 'Windows 95';
 
   if temp1 = 4 then
      if temp2 = 10 then
         Result := 'Windows 98';
 
   if temp1 = 4 then
      if temp2 = 90 then
         Result := 'Windows Me';
 
   if temp1 = 3 then
      if temp2 = 51 then
         Result := 'Windows NT 3.51';
 
   if temp1 = 4 then
      if temp2 = 0 then
         Result := 'Windows NT 4.0';
 
   if temp1 = 5 then
      if temp2 = 0 then
         Result := 'Windows 2000';
 
   if temp1 = 5 then
      if temp2 = 1 then
         Result := 'Windows XP';
 
   if temp1 = 6 then
      if temp2 = 0 then
         Result := 'Windows Vista';
 
   if temp1 = 6 then
      if temp2 = 1 then
         Result := 'Windows 7';
end;

Способ второй

{true = Win9x}{false = NT}
function isWin9x: Bool;
asm
   xor eax, eax
   mov ecx, cs
   xor cl, cl
   jecxz @@quit
   inc eax
   @@quit:
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
   if isWin9x then
      Form1.Caption := 'Win9x'
   else
      Form1.Caption := 'WinNT';
end;

Способ третий

procedure TForm1.FormCreate(Sender: TObject);
begin
   case Win32Platform of
      VER_PLATFORM_WIN32s: ShowMessage( 'System is Win32s' );
      VER_PLATFORM_WIN32_WINDOWS: ShowMessage( 'System is Windows 95' );
      VER_PLATFORM_WIN32_NT: ShowMessage( 'System is Windows NT' );
   end;
end;

Способ четвертый

procedure TForm1.Button1Click(Sender: TObject);
var
  s: string;
begin
   s := 'Win32Platform = ' + IntToStr( Win32Platform ) + #13 +
        'Win32MajorVersion = ' + IntToStr( Win32MajorVersion ) + #13 +
        'Win32MinorVersion = ' + IntToStr( Win32MinorVersion ) + #13 +
        'Win32BuildNumber = ' + IntToStr( Win32BuildNumber );
   ShowMessage( s );
end;

Способ пятый

procedure TForm1.Button1Click(Sender: TObject);
begin
   if CheckWin32Version( 6, 1 ) then
      ShowMessage( 'Windows 7' )
   else
   if CheckWin32Version( 6, 0 ) then
      ShowMessage( 'Windows Vista' )
   else
   if CheckWin32Version( 5, 1 ) then
      ShowMessage( 'Windows XP' )
   else
   if CheckWin32Version( 5, 0 ) then
      ShowMessage( 'Windows 2000' );
end;
Прочитано 9040 раз

Авторизация



Счетчики