Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
6. Feb 2003, 01:43
Delphi-Quellcode:
function GetOperatingSystem : String;
var
osVerInfo : TOSVersionInfo;
majorVer, minorVer : Integer;
begin
result := 'unbekannt';
{ set operating system type flag }
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(osVerInfo) then
begin
majorVer := osVerInfo.dwMajorVersion;
minorVer := osVerInfo.dwMinorVersion;
case osVerInfo.dwPlatformId of
VER_PLATFORM_WIN32_NT : { Windows NT/2000 }
begin
if majorVer <= 4 then
result := 'Windows NT'
else if (majorVer = 5) AND (minorVer= 0) then
result := 'Windows 2000'
else if (majorVer = 5) AND (minorVer = 1) then
result := 'Windows XP'
else
result := 'unbekannt';
result := result + ' (' +osverInfo.szCSDVersion+')';;
end;
VER_PLATFORM_WIN32_WINDOWS : { Windows 9x/ME }
begin
if (majorVer = 4) AND (minorVer = 0) then
result := 'Windows 95'
else if (majorVer = 4) AND (minorVer = 10) then
begin
if osVerInfo.szCSDVersion[1] = 'A' then
result := 'Windows 98 SE'
else
result := 'Windows 98';
end
else if (majorVer = 4) AND (minorVer = 90) then
result := 'Windows Millennium'
else
result := 'unbekannt';
end;
else
result := 'unbekannt';
end;
end
else
result := 'unbekannt';
end;
function GetVersionNumber: String;
var
osVerInfo : TOSVersionInfo;
MajorVer, MinorVer : Integer;
begin
result := 'unbekannt';
{ set operating system type flag }
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(osVerInfo) then
begin
majorVer := osVerInfo.dwMajorVersion;
minorVer := osVerInfo.dwMinorVersion;
case osVerInfo.dwPlatformId of
VER_PLATFORM_WIN32_NT : { Windows NT/2000 }
begin
if majorVer <= 4 then
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
else if (majorVer = 5) AND (minorVer= 0) then
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
else if (majorVer = 5) AND (minorVer = 1) then
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
else
result := 'unbekannt';
end;
VER_PLATFORM_WIN32_WINDOWS : { Windows 9x/ME }
begin
if (majorVer = 4) AND (minorVer = 0) then
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
else if (majorVer = 4) AND (minorVer = 10) then
begin
if osVerInfo.szCSDVersion[1] = 'A' then
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
else
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
end
else if (majorVer = 4) AND (minorVer = 90) then
result := IntToStr(OsVerInfo.dwMajorVersion)+'.'+IntToStr(OsVerInfo.dwMinorVersion)+
'.'+IntToStr(OsVerInfo.dwBuildNumber)
else
result := 'unbekannt';
end;
else
result := 'unbekannt';
end;
end
else
result := 'unbekannt';
end;
Michael Ein Teil meines Codes würde euch verunsichern.
|