SYSTEM_INFO SystemInfo;
//检测CPU的类型
::GetSystemInfo(&SystemInfo); //WinAPI函数,用以取得系统信息
if(SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{
switch (SystemInfo.wProcessorLevel)
{
//本程序只演示取得Intel系列CPU的方法
//省略对386及486机器的检测
case 5:
DisplayString = "Pentium";
break;
case 6:
DisplayString = "Pentium (II/Pro)";
break;
}
}
m_CpuType.SetWindowText(DisplayString); //变量m_CpuType是一个CStatic框
MEMORYSTATUS MemoryStatus; //内存的现行状态结构
MemoryStatus.dwLength = sizeof(MEMORYSTATUS); //填充结构的大小
::GlobalMemoryStatus(&MemoryStatus); //取得内存的状态
char buffer[20];
wsprintf(buffer,"%d bytes",MemoryStatus.dwTotalPhys);//dwTotalPhys指示物理内存字节
m_Memory.SetWindowText(buffer); //变量m_Memory是一个CStatic框