c++获取cpu、显卡、操作系统名称代码 20
如题,用c++程序获取cpu(IntelCore)显卡(ATIMOBILITY)操作系统(WindowsXP)括号中的3个名称c++代码应该怎么写呢(最好带注释)...
如题,用c++程序获取cpu(Intel Core)显卡(ATI MOBILITY)操作系统(Windows XP)
括号中的3个名称 c++代码应该怎么写呢(最好带注释) 展开
括号中的3个名称 c++代码应该怎么写呢(最好带注释) 展开
2个回答
展开全部
cpu(Intel Core)显卡(ATI MOBILITY)
用WMI 获取;
操作系统:
void GetOsInfo(vector <CString> &vstr)
{
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
CString str;
if(GetVersionEx ((OSVERSIONINFO*)&osvi))
{
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
{
str = "操作系统 : Windows 2000 ";
}
else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
{
str = "操作系统 : Windows XP ";
}
else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
{
str = "操作系统 : Windows 2003 ";
}
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
{
str = "操作系统 : Windows Vista";
}
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2)
{
str = "操作系统 : Windows 7 ";
}
else
{
str = "神秘的操作系统";
}
}
else
{
str = "获取操作系统出错";
}
vstr.push_back(str);
}
用WMI 获取;
操作系统:
void GetOsInfo(vector <CString> &vstr)
{
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
CString str;
if(GetVersionEx ((OSVERSIONINFO*)&osvi))
{
if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
{
str = "操作系统 : Windows 2000 ";
}
else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
{
str = "操作系统 : Windows XP ";
}
else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
{
str = "操作系统 : Windows 2003 ";
}
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
{
str = "操作系统 : Windows Vista";
}
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2)
{
str = "操作系统 : Windows 7 ";
}
else
{
str = "神秘的操作系统";
}
}
else
{
str = "获取操作系统出错";
}
vstr.push_back(str);
}
追问
cpu(Intel Core)显卡(ATI MOBILITY)
用WMI 获取;
请问代码怎么写呢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询