Detect Windows version(Xp compatible)
In article <3d0d9d24$...@news.iprimus.com.au>, "hoezz" <ho...@iprimus.com.au>
writes:
Quote
>How can I detect which version of Windows is running including
>XP, 98/98Se, NT, etc.
There are various conjunctions of Win32MajorVersion, Win32MinorVersion, and
Win32Platform for each operating system version as follows . . .
type
TOperatingSystem = (osUnknown, osWin95, osWin98, osWinNT, osWinXP, osWin2K);
function WinOpSys : TOperatingSystem;
var
Win95, Win98, WinNT, Win2K, WinXP : boolean; // all these for code clarity
begin
Win95 := (Win32MajorVersion = 4) and (Win32MinorVersion = 0)
and (Win32Platform = VER_PLATFORM_WIN32_WINDOWS);
Win98 := (Win32MajorVersion = 4) and (Win32MinorVersion = 10)
and (Win32Platform = VER_PLATFORM_WIN32_WINDOWS);
WinNT := (Win32MajorVersion = 4) and (Win32MinorVersion = 0)
and (Win32Platform = VER_PLATFORM_WIN32_NT);
WinXP := (Win32MajorVersion = 5) and (Win32MinorVersion = 1)
and (Win32Platform = VER_PLATFORM_WIN32_NT);
Win2K := (Win32MajorVersion = 5) and (Win32MinorVersion = 0)
and (Win32Platform = VER_PLATFORM_WIN32_NT);
Result := osUnknown; // default
if Win95 then
Result := osWin95
else
if Win98 then
Result := osWin98
else
if WinNT then
Result := osWinNT
else
if WinXP then
Result := osWinXP
else
if Win2k then
Result := osWin2K;
end;
Alan Lloyd