美文网首页
C++程序中判断当前Windows系统

C++程序中判断当前Windows系统

作者: 小染灬 | 来源:发表于2017-06-08 14:44 被阅读0次

    OSVERSIONINFOEX WinVersion;

    ZeroMemory(&WinVersion,sizeof(OSVERSIONINFOEX));

    WinVersion.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEX);

    BOOL flag=(BOOL)GetVersionEx((OSVERSIONINFO *)&WinVersion);//得到当前版本号

    float fSysVer = 0.;

    fSysVer = WinVersion.dwMajorVersion + WinVersion.dwMinorVersion * 0.1;

    win 95              4.0

    win 98              4.1

    win 2000win NT)      5.0

    win xp(NT5.1)         5.1

    win 2003          5.2

    win Vista          6.0

    win 7               6.1

    typedef struct _OSVERSIONINFOEXW {

    DWORD dwOSVersionInfoSize;

    DWORD dwMajorVersion;

    DWORD dwMinorVersion;

    DWORD dwBuildNumber;

    DWORD dwPlatformId;

    WCHAR  szCSDVersion[ 128 ]; 

    WORD  wServicePackMajor;

    WORD  wServicePackMinor;

    WORD  wSuiteMask;

    BYTE  wProductType;

    BYTE  wReserved;

    }

    相关文章

      网友评论

          本文标题:C++程序中判断当前Windows系统

          本文链接:https://www.haomeiwen.com/subject/doxtqxtx.html