Search code examples
c++windowsversion

Check Windows version


How I can check in C++ if Windows version installed on computer is Windows Vista and higher (Windows 7)?


Solution

  • Similar to other tests for checking the version of Windows NT:

    OSVERSIONINFO   vi;
    
    memset (&vi, 0, sizeof vi);
    vi .dwOSVersionInfoSize = sizeof vi;
    GetVersionEx (&vi);
    if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT  &&  vi.dwMajorVersion >= 6)