GetVersion()函数得到当前操作系统的版本号,使用它可以用来判断当前是什么操作系统.
函数原型:
DWORD GetVersion(VOID); //没有参数
返回值:
如果函数成功的,那么它会返回一个DWORD值,该值包含了当前操作系统的低字节序和高字节序的主副版本号。低字节序指向的是操作系统的主版本号,高字节序指向的是操作系统的副版本号。
参考如下:
实例:(for example)
#include <iostream.h>
#include <windows.h>

int main(void)
{
if (GetVersion() < 0x80000000)
{
cout<<"Current System Version: Windows NT/2000/XP"<<endl;
}
else
{
cout<<"Current System Version: Windows 32s/95/98/me/"<<endl;
}
return 0;
}
函数原型:
DWORD GetVersion(VOID); //没有参数
返回值:
如果函数成功的,那么它会返回一个DWORD值,该值包含了当前操作系统的低字节序和高字节序的主副版本号。低字节序指向的是操作系统的主版本号,高字节序指向的是操作系统的副版本号。
参考如下:
Platform | High-order bit | Next 7 bits | Low-order byte |
---|---|---|---|
Windows NT 3.51 | 0 | Build number | 3 |
Windows NT 4.0 | 0 | Build number | 4 |
Windows 2000 or Windows XP | 0 | Build number | 5 |
Windows 95, Windows 98, or Windows Me | 1 | Reserved | 4 |
Win32s with Windows 3.1 | 1 | Build number | 3 |
实例:(for example)














