Sign in Join
Wiki copytemporary

Revision 1 of 1, by FTurtle on 12-10-2020. The page as it is now.

WindowsVersion/de

Zurück zur Seite Code Beispiele.\

Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
Die Funktion ermittelt die Nummer der aktuellen Windowsversion.\

pascal
uses
  Windows, SysUtils, ...;

  ...

{
Beispiele für Windows-Versionsnummern:
5.0 => Windows 2000
5.1 => Windows XP
5.2 => Windows XP64 oder Windows 2003 Server
6.0 => Windows Vista oder Windows 2008 Server
6.1 => Windows 7 oder Windows 2008 Server R2
6.2 => Windows 8 oder Windows Server 2012
6.3 => Windows 8.1 oder Windows Server 2012 RS
}

function funGetWinVer: string;
// Liefert die Versionsnummer von Windows als String
begin
  Result := IntToStr(LOBYTE(LOWORD(GetVersion)));
  Result := Result + '.';
  Result := Result + IntToStr(HIBYTE(LOWORD(GetVersion)));
end;

Alternativ stellt die Unit SysUtils die Versionsinformationen in Variablen bereit:

pascal
program EchoWinVersion;
uses sysutils;
begin
  Writeln('Win32Platform    : ', Win32Platform    );
  Writeln('Win32MajorVersion: ', Win32MajorVersion);
  Writeln('Win32MinorVersion: ', Win32MinorVersion);
  Writeln('Win32BuildNumber : ', Win32BuildNumber );
  Writeln('Win32CSDVersion  : ', Win32CSDVersion  );
  readln;
end.

Die Ausgabe sieht für Windows 7 Service Pack 1 so aus:

pascal
Win32Platform    : 2
Win32MajorVersion: 6
Win32MinorVersion: 1
Win32BuildNumber : 7601
Win32CSDVersion  : Service Pack 1

From the Free Pascal wiki, page "WindowsVersion/de", as it stood on 2020-12-10 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.