★ wanayoo — archive 1999 http://codeguru.developer.com/system/WinOS.shtmlNouvelle recherche | Portail wanayoo
EarthWeb
Developer.com Click Here!
Click Here!
Find:
 

EXPERT SEARCH
SEARCH THE IT WEB -----
Site
windows 2000
visual c++
java
visual basic
javascripts
recommend it
 
Contest
mfc codeguru
submission guidelines
 
Book
thinking in c++
stl programmer's guide
reviews
 
Interact
forums
newsgroups
guest book
jobs
jokes
open faq
what's new
 
Other
about
links
newsletters
privacy
tools
 

-----
Visual C++ by E-mail:

Get the weekly e-mail highlights on
Visual C++!
-----



EarthWeb Sites:
IT Management
Networking & Telecommunications
IT Jobs
Software Development
Hardware & Systems
Commerce
Community

EarthWeb Worldwide

   

Detecting the windows version running on your machine


This article was contributed by Rob Fullington.

The following code retrieves the current Windows Operating System name and version (with Service Packs) into a CString.


OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
CString WindowsPlatform;
if (GetVersionEx(&osv))
{
 // note: szCSDVersion =  service pack  release  
 CString ServiceRelease = osv.szCSDVersion;
 switch(osv.dwPlatformId)
 {
  case VER_PLATFORM_WIN32s: //Win32s on Windows 3.1.
   WindowsPlatform = "Microsoft® Windows 3.1(TM)";
  break;

  case VER_PLATFORM_WIN32_WINDOWS: //WIN32 on 95 or 98
   //determine if Win95 or Win98
   if (osv.dwMinorVersion == 0)
   {
    WindowsPlatform = "Microsoft® Windows 95(TM) " + ServiceRelease;
   }
   else
   {
    WindowsPlatform = "Microsoft® Windows 98(TM) " + ServiceRelease;
   }
  break;

  case VER_PLATFORM_WIN32_NT: //Win32 on Windows NT.
   WindowsPlatform = "Microsoft® Windows NT(TM) "  + ServiceRelease;
  break;

  default:
   AfxMessageBox("Failed to get correct Operating System.", MB_OK);  
 } //end switch
} //end if

Date Last Updated: March 1, 1999

Comments:

Add Comment

   

Give them a visit Click Here!

Click Here!

INSTANT EXPERTS!
Savvy IT Pros report on SupportSource. Take a look inside the largest vault of multi-vendor computing specs ever assembled. Click here for an In-depth Report,.

For tons of Windows technology resources, check out the Windows Programming directory.

Go to Fatbrain for the NEWEST and BEST technical books for IT professionals.

Searching the Web for tech topics just got better with
TechCrawler where all results come only from popular technical sites.

WINNER!!!
Congratulations to James Hole, of New Mexico! The grand prize winner of EarthWeb's Flatten the Obstacles Sweepstakes and now a proud Hummer(R) owner.

Give them a visit Click Here!

Click Here!

Click Here!

Click Here!

Home About Us Search Subscribe Advertising Info Contact Us FAQs
Use of this site is subject to certain Terms & Conditions.
Earthweb's statement regarding our users' right to privacy.
Copyright ©1996-2000 EarthWeb Inc.. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited.