首页 > 其他 > 详细

GetVersion

时间:2020-03-23 10:19:26      阅读:46      评论:0      收藏:0      [点我收藏+]

  

Windows 提供了GetVersionEx 函数来返回当前操作系统的版本信息

#include "stdafx.h"
#include "windows.h"
#include "iostream.h"
int main(int argc, char* argv[])
{
    OSVERSIONINFO os={sizeof(os)};
    GetVersionEx(&os);
    cout<<os.dwBuildNumber<<endl;
    cout<<os.dwMajorVersion<<endl;
    cout<<os.dwMinorVersion<<endl;
    cout<<os.dwOSVersionInfoSize<<endl;
    cout<<os.dwPlatformId<<endl;
    cout<<os.szCSDVersion<<endl;
    return 0;
}

**************************************
// 1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "windows.h"
#include "iostream.h"
int main(int argc, char* argv[])
{
    OSVERSIONINFO os={sizeof(os)};
    GetVersionEx(&os);
//     cout<<os.dwBuildNumber<<endl;
//     cout<<os.dwMajorVersion<<endl;
//     cout<<os.dwMinorVersion<<endl;
//     cout<<os.dwOSVersionInfoSize<<endl;
//     cout<<os.dwPlatformId<<endl;
//     cout<<os.szCSDVersion<<endl;

    if(os.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
        cout<<"是windows98系列的操作系统"<<endl;
    else
        cout<<"是windowsNT系列的操作系统"<<endl;
    return 0;
}

 

GetVersion

原文:https://www.cnblogs.com/butchert/p/12550029.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!