Getting the System Version
The following example uses the GetVersionEx function to retrieve version information about the currently running operating system.
Note If your application requires a particular operating system version, use the VerifyVersionInfo function to determine whether the currently running system satisfies your requirements. For sample code that uses VerifyVersionInfo, see Verifying the System Version.
// Try calling GetVersionEx using the OSVERSIONINFOEX structure,
// which is supported on Windows 2000.
//
// If that fails, try using the OSVERSIONINFO structure.