function TForm1.GetOSVersion:String;
var
OSVersion: TOSVersionInfo;
FVersion,FPlatform,serPack:String;
FPlatformID: DWord;
begin
OSVersion.dwOSVersionInfoSize := SizeOf(OSVersion);
if GetVersionEx(OSVersion) then
begin
FVersion := Format('%d.%d (%d.%s)',[OSVersion.dwMajorVersion, OSVersion.dwMinorVersion,(OSVersion.dwBuildNumber and $FFFF), OSVersion.szCSDVersion]);
FPlatformID:= OSVersion.dwPlatformID;
case OSVersion.dwPlatformID of
1:begin
Case OSVersion.dwMinorVersion of
0: FPlatform := 'Windows 95';
10: FPlatform := 'Windows 98';
90: FPlatform := 'Windows Millennium';
end;
end;
2:begin
Case OSVersion.dwMajorVersion of
3:FPlatform := 'Windows NT 3.51';
4:FPlatform := 'Windows NT 4.0';
5:begin
if OSVersion.dwMinorVersion=0 then
FPlatform := 'Windows 2000'
else
FPlatform := 'Windows XP';
end;
end;
end;
else
FPlatform := '';
end; end; serPack:=OSVersion.szCSDVersion;
result:=FPlatform+' '+serPack;
end;
Label3.Caption := GetOSVersion;