http://blog.csdn.net/amars_ding/article/details/54580441
#include <windows.h> #define MB (1024*1024) //! network void MainWindow::on_network_clicked() { SYSTEM_INFO systemInfo; GetSystemInfo(&systemInfo); qDebug() << QString::fromUtf8("处理器掩码:") << systemInfo.dwActiveProcessorMask; qDebug() << QString::fromUtf8("处理器个数:") << systemInfo.dwNumberOfProcessors; qDebug() << QString::fromUtf8("处理器分页大小:") << systemInfo.dwPageSize; qDebug() << QString::fromUtf8("处理器类型:") << systemInfo.dwProcessorType; qDebug() << QString::fromUtf8("最大寻址单元:") << systemInfo.lpMaximumApplicationAddress; qDebug() << QString::fromUtf8("最小寻址单元:") << systemInfo.lpMinimumApplicationAddress; qDebug() << QString::fromUtf8("处理器等级:") << systemInfo.wProcessorLevel; qDebug() << QString::fromUtf8("处理器版本:") << systemInfo.wProcessorRevision; qDebug() << "----------------------------------------"; MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); GlobalMemoryStatusEx (&statex); qDebug() << /*QString::fromUtf8("物理内存使用率:") <<*/ statex.dwMemoryLoad; qDebug() <</* QString::fromUtf8("物理内存总量:") <<*/ statex.ullTotalPhys/MB; qDebug() << /*QString::fromUtf8("可用的物理内存:") <<*/ statex.ullAvailPhys/MB; qDebug() << /*QString::fromUtf8("系统页面文件大小:") <<*/ statex.ullTotalPageFile/MB; qDebug() << /*QString::fromUtf8("系统可用页面文件大小:") <<*/ statex.ullAvailPageFile/MB; qDebug() << /*QString::fromUtf8("虚拟内存总量:") << */statex.ullTotalVirtual/MB; qDebug() << /*QString::fromUtf8("可用的虚拟内存:") << */statex.ullAvailVirtual/MB; qDebug() << /*QString::fromUtf8("保留(值为0):") <<*/ statex.ullAvailExtendedVirtual/MB; }