1个回答
展开全部
定义
OSVERSIONINFO osvi;
GetVersionExW(&osvi);
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion == 5&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows 2000");
}
else if (osvi.dwMajorVersion == 5&&osvi.dwMinorVersion == 1)
{
strOSVersion = TEXT("Windows XP");
}
else if(osvi.dwMajorVersion == 6&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows Vista");
}
else if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows NT");
}
break;
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 10)
{
strOSVersion = TEXT("Windows 98");
}
else if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 90)
{
strOSVersion = TEXT("Windows ME");
}
else
{
strOSVersion = TEXT("Windows 95");
}
break;
default:
break;
}
OSVERSIONINFO osvi;
GetVersionExW(&osvi);
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion == 5&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows 2000");
}
else if (osvi.dwMajorVersion == 5&&osvi.dwMinorVersion == 1)
{
strOSVersion = TEXT("Windows XP");
}
else if(osvi.dwMajorVersion == 6&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows Vista");
}
else if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 0)
{
strOSVersion = TEXT("Windows NT");
}
break;
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 10)
{
strOSVersion = TEXT("Windows 98");
}
else if (osvi.dwMajorVersion == 4&&osvi.dwMinorVersion == 90)
{
strOSVersion = TEXT("Windows ME");
}
else
{
strOSVersion = TEXT("Windows 95");
}
break;
default:
break;
}
参考资料: http://z.baidu.com/question/140317810.html?si=2
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询