provided by: 
Originally published at Internet.com
Environment: VC6, Windows 2000, Windows NT 4.0 SP3
Note: This article is specific to Windows 2000 and Windows NT 4.0 SP3+. It does not support Windows 95 or 98. For Windows NT 4, you will need PDH.DLL and PDH.LIB which are not supplied with the OS.
I wrote this code because I couldn't find any good resource meters for Windows 2000. Plenty of them exist for Windows 95/98 and I figured that I might as well write my own.
I have wrapped the PDH into a nice C++ class called CPerfMon. It will support all the counters available under Windows. I have done some predefined timers for easy use. These are as follows: // % of cpu in use #define CNTR_CPU "\\Processor(_Total)\\% Processor Time" // mem in use measured in bytes #define CNTR_MEMINUSE_BYTES "\\Memory\\Committed Bytes" // mem available measured in bytes #define CNTR_MEMAVAIL_BYTES "\\Memory\\Available Bytes" // mem avail in kilobytes #define CNTR_MEMAVAIL_KB "\\Memory\\Available KBytes" // mem avail in megabytes #define CNTR_MEMAVAIL_MB "\\Memory\\Available MBytes" // % of mem in use #define CNTR_MEMINUSE_PERCENT "\\Memory\\% Committed Bytes In Use" // commit limit on memory in bytes #define CNTR_MEMLIMIT_BYTES "\\Memory\\Commit Limit" ...
Read article at Internet.com site