欢迎转载,但转载时请注明本博客出处:http://blog.csdn/pingd/article/details/22396517,谢谢!
这里也只是一个功能函数而已,话不多说,直接上代码:
//获取操作系统名字,如windows 7
//成功返回系统信息,失败返回NULL
char *GetVersionInfo()
{
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx(&osvi)) {
return NULL;
}
//判断版本
if (osvi.dwMajorVersion == 5) {
switch (osvi.dwMinorVersion) {
case 0:
return "Windows 2000";
case 1:
return "Windows XP";
case 2:
return "Windows Server 2003";
default:
return "Unknown System&
欢迎转载,但转载时请注明本博客出处:http://blog.csdn/pingd/article/details/22396517,谢谢!
这里也只是一个功能函数而已,话不多说,直接上代码:
//获取操作系统名字,如windows 7
//成功返回系统信息,失败返回NULL
char *GetVersionInfo()
{
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx(&osvi)) {
return NULL;
}
//判断版本
if (osvi.dwMajorVersion == 5) {
switch (osvi.dwMinorVersion) {
case 0:
return "Windows 2000";
case 1:
return "Windows XP";
case 2:
return "Windows Server 2003";
default:
return "Unknown System&