Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Windows Vista Erkennen (https://www.delphipraxis.net/86726-windows-vista-erkennen.html)

hedie 18. Feb 2007 18:06


Windows Vista Erkennen
 
Hallo

Ich benutze Delphi 2006 Architect und Programmiere nun unter Windows Vista Ultimate

Ich wollte fragen ob es eine Möglichkeit gibt, zu erkennen welche Windows Version Installier ist.

Für XP und der gleichen hab ich was

Delphi-Quellcode:
function GetWinVersion: string;
begin
  result:='Unbekannte Version';
  case Win32Platform of
    1:// 9x-Reihe
      If Win32MajorVersion=4 Then Begin
        Case Win32MinorVersion of
            0: result:='Windows 95';
            10: result:='Windows 98';
            90: result:='Windows Me';
        end;
      end;
  2: // NT-Reihe
     Case Win32MajorVersion of
         3:IF Win32MinorVersion=51 then
              result:='Windows NT 3.51';
         4:If Win32MinorVersion=0 then
             result:='Windows NT 4';
         5:Case Win32MinorVersion of
              0: result:='Windows 2000';
              1: result:='Windows XP';
              2: result:='Windows .NET Server';
           end;
     End;
  end;
  //Win32CSDVersion enthält Informationen zu Servicepacks
  if Win32CSDVersion<>'' then
    result:=result+' '+Win32CSDVersion;
end;
Aber des geht ja nicht für Vista. Vieleicht habt ihr da ne idee.

Vielen dank
Claudio Hediger

alcaeus 18. Feb 2007 18:07

Re: Windows Vista Erkennen
 
Windows Vista ist Windows 6.0; also ist Win32MajorVersion 6, und Win32MinorVerision 0 ;)

Greetz
alcaeus

hedie 18. Feb 2007 18:14

Re: Windows Vista Erkennen
 
Also hab ich das richtig verstanden, das es so gehen müsste?

Delphi-Quellcode:
function GetWinVersion: string;
begin
  result:='Unbekannte Version';
  case Win32Platform of
    1:// 9x-Reihe
      If Win32MajorVersion=4 Then Begin
        Case Win32MinorVersion of
            0: result:='Windows 95';
            10: result:='Windows 98';
            90: result:='Windows Me';
        end;
      end;
/////////////////////////////////////////////
If Win32MajorVersion=6 Then Begin
  Case Win32MinorVersion of
0: result:='Windows Vista';
end;

  2: // NT-Reihe
     Case Win32MajorVersion of
         3:IF Win32MinorVersion=51 then
              result:='Windows NT 3.51';
         4:If Win32MinorVersion=0 then
             result:='Windows NT 4';
         5:Case Win32MinorVersion of
              0: result:='Windows 2000';
              1: result:='Windows XP';
              2: result:='Windows .NET Server';
              3: result:='Windows Vista';
           end;
     End;
  end;
  //Win32CSDVersion enthält Informationen zu Servicepacks
  if Win32CSDVersion<>'' then
    result:=result+' '+Win32CSDVersion;
end;

alcaeus 18. Feb 2007 18:17

Re: Windows Vista Erkennen
 
gnarf, nein.
Delphi-Quellcode:
function GetWinVersion: string;
begin
  result:='Unbekannte Version';
  case Win32Platform of
    1:// 9x-Reihe
      If Win32MajorVersion=4 Then Begin
        Case Win32MinorVersion of
            0: result:='Windows 95';
            10: result:='Windows 98';
            90: result:='Windows Me';
        end;
      end;
  2: // NT-Reihe
     Case Win32MajorVersion of
         3:IF Win32MinorVersion=51 then
              result:='Windows NT 3.51';
         4:If Win32MinorVersion=0 then
             result:='Windows NT 4';
         5:Case Win32MinorVersion of
              0: result:='Windows 2000';
              1: result:='Windows XP';
              2: result:='Windows .NET Server';
           end;
         6:case Win32MinorVersion of
              0: result := 'Windows Vista';
           end;
     End;
  end;
  //Win32CSDVersion enthält Informationen zu Servicepacks
  if Win32CSDVersion<>'' then
    result:=result+' '+Win32CSDVersion;
end;
Greetz
alcaeus

hedie 18. Feb 2007 18:18

Re: Windows Vista Erkennen
 
Achsooo Danke vielen dank :D


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:43 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz