SYSTEM_INFO sysInfo; //获取硬件信息
GetSystemInfo (&sysInfo); //检查处理器的类型
if (sysInfo.dwProcessorType==PROCESSOR_INTEL_386)
{
m_strProcessorType =_T("Intel 386");
}
else if (sysInfo.dwProcessorType==PROCESSOR_INTEL_486)
{
m_strProcessorType = _T("Intel 486");
}
else if (sysInfo.dwProcessorType==PROCESSOR_INTEL_PENTIUM)
{
m_strProcessorType =_T("Intel Pentium");
}
else
{
m_strProcessorType = _T("Unknown");
}
//检查处理器的个数
CString str;
str.Format("%d",sysInfo.dwNumberOfProcessors);
m_strProcessorNum = str;
LONG result;
HKEY hKey;
DWORD data;
DWORD dataSize;
//打开注册表
result = ::RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"Hardware\\Description\\System\\CentralProcessor\\0", 0, KEY_QUERY_VALUE, &hKey);
// 获取CPU的处理速度
if (result==ERROR_SUCCESS)
{
result = ::RegQueryValueEx (hKey, _T("~MHz"), NULL, NULL,(LPBYTE)&data, &dataSize);
m_strCPUSpeed.Format ("%d", data);
m_strCPUSpeed += _T (" MHz");
}
RegCloseKey (hKey);//关闭注册表
UpdateData(FALSE);
锐英源哪有例子代码。