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
Add Comment
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 withTechCrawler 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.
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.