Designing and developing good software requires an understanding of the hardware platform the software is running on. This Platform Discovery Code sample is a starting point to help application developers gather information about the platform on which the software is running. It lets you adapt the behavior of the application appropriately; for example, that new virus checker you're writing may choose to not perform a check when the batter is low! Included is code to check CPU information (number of physical and logical processors, CPU frequency and utilization), network connections as well as battery information (whether the battery is being charged, current battery state and dissipation rate).
This code sample provides a set of C++ classes to implement the platform discovery features. In addition to the core C++ classes, a set of COM objects are also made available that encapsulate this functionality and which can in turn be called from other languages supported by .Net. A sample HTML page embeds these COM objects, showing the results of running the platform discovery code. The download is made available as an MSI file. This installs the source code, as well as lib and demo application.
The sample code includes the capability to discover the platform features below.
CPU information:
• Number of Physical Processors
• Number of Logical Processors
• CPU Frequency
• CPU Utilization
Battery information:
• Full charge value
• Battery power state
• Battery dissipation rate
Network:
• Connection State
Physical Disk:
• Percent Disk Time
Please download the sample code package and try to create your own software applications.
Reference