Going to the registry can be a pain as the layout of the registry changes with each platform...
The Disk Space and memory size can be found with published APIs....
Clock speed is a bit more problematic, but there is a key in the Windows 2000 registry which gives an indication...I cant vouch for other platforms as my 2 pcs have Win2K
Monitor type is probably not worth looking for.....many monitors are loaded as "default monitor" as they use a default PnP driver.......therefore even if you found the name of the driver, it might not correspond to the device sat in front of you
Anyway...here's a few ideas...
Code:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <windows.h>
using namespace std;
int main(void){
///////////////////////////////////////////
//
// First off - Memory size
//
MEMORYSTATUS ms = {0};
GlobalMemoryStatus(&ms);
cout << "Total amount of physical memory = ";
cout << ms.dwTotalPhys / 1048576<< "MB" << endl;
///////////////////////////////////////////
//
// Now to peek in the registry for CPU speed
//
HKEY hKey;
char *lpValName = "~MHz",
*lpKey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
DWORD dwProcSpeed,dwSize,dwType;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,lpKey,
NULL,KEY_READ,&hKey) == ERROR_SUCCESS){
dwSize = sizeof(DWORD);
dwType = REG_DWORD;
if(RegQueryValueEx(hKey,lpValName,NULL,&dwType,
(LPBYTE)&dwProcSpeed,&dwSize) == ERROR_SUCCESS){
double dProcSpeed = (double)dwProcSpeed;
dProcSpeed /= 100;
dwProcSpeed = ceil(dProcSpeed);
dwProcSpeed *= 100;
cout << "CPU speed = " << dwProcSpeed;
cout << "Mhz" << endl;
}
else cout << "Could not find processor speed" << endl;
}
else cout << "Could not find processor speed information" << endl;
RegCloseKey(hKey);
///////////////////////////////////////////
//
// Now to Get the free space
//
DWORD dwSectorsPerCluster,dwBytesPerSector,
dwNumberOfFreeClusters,dwTotalNumberOfClusters;
if(GetDiskFreeSpace(NULL,&dwSectorsPerCluster,&dwBytesPerSector,
&dwNumberOfFreeClusters,&dwTotalNumberOfClusters)){
double dFreeSpace =
dwBytesPerSector * dwSectorsPerCluster *
dwNumberOfFreeClusters;
cout.precision(3);
cout << "This disk has " << dFreeSpace / 1073741824;
cout << "GB free" << endl;
}
else cout << "Could not find disk size information" << endl;
return 0;
}