Detect windows NT

How do I find out if the current system is a WindowsNT system?  And, detect if it isnt...

i.e.   If(WindowsNT){
             Blah
        }else{
             Blah
         }


Nitro187Asked:
Who is Participating?
 
igrooveConnect With a Mentor Commented:
You can use the GetVersion() API from the SDK.  Or the GetVersionEx() API.  I prefer the GetVersionEx() API when I want richer amounts of information:

//  code to get OS environment
//  using GetVersionEx

BOOL  bWinNT = FALSE;
OSVERSIONINFO osv;

ZeroMemory(&osv, sizeof(OSVERSIONINFO));

//  always set this before the call!
osv.dwOSVersionInfoSize =
  sizeof(OSVERSIONINFO);

if (GetVersionEx(&osv))
{
  bWinNT = (VER_PLATFORM_WIN32_NT ==
    osv.dwPlatformId);
}
else // an error occured
{
  //  call GetLastError() to get info
}

//  code to get OS using GetVersion()

DWORD dwVer = GetVersion();
BOOL bNT = dwVer < 0x80000000;
0
 
Nitro187Author Commented:
Thanks a lot  :D
0
All Courses

From novice to tech pro — start learning today.