(Gast)
n/a Beiträge
|
Windows-Version ermitteln
19. Jul 2003, 22:22
Hallo,
hiermit kann man sich die Windowsversion anzeigen lassen, samt Service Packs usw..
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
function GetWinVer: String;
var
OsVinfo: TOSVERSIONINFO;
TmpStr: array[0..255] of Char;
begin
ZeroMemory(@OsVinfo, SizeOf(OsVinfo));
OsVinfo.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO);
if GetVersionEx(OsVinfo) then
begin
if OsVinfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
begin
if (OsVinfo.dwMajorVersion = 4) and (OsVinfo.dwMinorVersion > 0) then
begin
StrFmt(TmpStr, 'Windows 98 - Version %d.%.2d, Build %d, %s',
[OsVinfo.dwMajorVersion, OsVinfo.dwMinorVersion,
OsVinfo.dwBuildNumber and $FFFF, OSVinfo.szCSDVersion])
end
else
begin
StrFmt(TmpStr, 'Windows 95 - Version %d.%d, Build %d, %s',
[OsVinfo.dwMajorVersion, OsVinfo.dwMinorVersion,
OsVinfo.dwBuildNumber and $FFFF, OSVinfo.szCSDVersion]);
end;
end;
if OsVinfo.dwPlatformId = VER_PLATFORM_WIN32_NT then
begin
StrFmt(TmpStr, 'Microsoft Windows NT Version %d.%.2d, Build %d, %s',
[OsVinfo.dwMajorVersion, OsVinfo.dwMinorVersion,
OsVinfo.dwBuildNumber and $FFFF, OSVinfo.szCSDVersion]);
end
end
else
begin
StrCopy(TmpStr, 'Fehler bei GetVersionEx()!');
end;
Result := TmpStr;
end;
begin
ShowMessage(GetWinVer);
end;
Grüsse, Daniel
Suchbegriffe: Windows Version
[edit=Matze]Suchbegriffe ergänzt. MfG, Matze[/edit]
|
|
Zitat
|