Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Aug : Is the copy of Windows running XP or 2K?

www.cryer.info
Managed Newsgroup Archive

Is the copy of Windows running XP or 2K?

Subject:Is the copy of Windows running XP or 2K?
Posted by:"Ace" (askaquesti..@rogers.vom)
Date:Wed, 10 Aug 2005 22:50:27 -0400

How do I use Delphi to determine if the copy of Windows running is XP or 2K?
On the net it's easy to find how to determine between NT, 98, 95 and 2K, but
not between XP and 2K. Here's the best code on the net. But it assume you
don't care whether you're running 2K or XP. On the contrary, I *think* I
care.

type
   TWin32Version = (wvUnknown,wvWin95,wvWin98,wvWinNT,wvWin2000) ;
function GetWinVersion: TWin32Version;
begin
   Result := wvUnknown;
   if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
     if (Win32MajorVersion > 4) or
        ((Win32MajorVersion = 4) and
        (Win32MinorVersion > 0)) then
       Result := wvWin98
     else
       Result := wvWin95
   else
     if Win32MajorVersion <= 4 then
       Result := wvWinNT
     else
       if Win32MajorVersion = 5 then
         Result := wvWin2000
end;

Info

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive