HardMon SDK Documentation

Getting Started

Requirements

  1. .NET Framework 2.0/3.5/4.0 or later
  2. C#/VB.NET project (Console, WPF, WinForms, etc.)

Installation

  1. Add a reference to HardEngine.dll in your C# project
  2. Import the namespace in your code file:
using HardMon;

Core Classes

Hardware Class

The main class that provides access to all monitoring functionality.

Constructor

Hardware hardware = new Hardware();

Data Classes

The library provides several data classes that contain structured information about each component:

  • CPUInfo - Contains CPU-related information
  • GPUInfo - Contains GPU-related information
  • RAMInfo - Contains RAM-related information
  • HDDInfo - Contains hard drive-related information

Usage Examples

Basic Initialization

// Create an instance of the Hardware class
Hardware hardware = new Hardware();
    
// Refresh all hardware data
hardware.Refresh();

Getting System Information

string userName = hardware.GetUserName();
string systemName = hardware.GetSystemName();
string cpuName = hardware.GetCPUName();
int coreCount = hardware.CoreCount();

Retrieving CPU Information

List<CPUInfo> cpuInfos = hardware.CPUInfos();

foreach (CPUInfo cpu in cpuInfos)
{
    Console.WriteLine($"CPU: {cpu.Name}");
    
    foreach (string clock in cpu.Clock)
    {
        Console.WriteLine($"  {clock}");
    }
    
    foreach (string temp in cpu.Temperature)
    {
        Console.WriteLine($"  {temp}");
    }
    
    foreach (string load in cpu.Load)
    {
        Console.WriteLine($"  {load}");
    }
}
		

Retrieving GPU Information

List<GPUInfo> gpuInfos = hardware.GPUInfos();

foreach (GPUInfo gpu in gpuInfos)
{
    Console.WriteLine($"GPU: {gpu.Name}");
    
    foreach (string temp in gpu.Temperature)
    {
        Console.WriteLine($"  {temp}");
    }
    
    foreach (string load in gpu.Load)
    {
        Console.WriteLine($"  {load}");
    }
    
    foreach (string clock in gpu.Clock)
    {
        Console.WriteLine($"  {clock}");
    }
}
	   

Retrieving RAM Information

List<RAMInfo> ramInfos = hardware.RAMInfos();

foreach (RAMInfo ram in ramInfos)
{
    Console.WriteLine($"RAM: {ram.Name}");
    
    foreach (string load in ram.Load)
    {
        Console.WriteLine($"  {load}");
    }
    
    foreach (string used in ram.Used)
    {
        Console.WriteLine($"  {used}");
    }
    
    foreach (string available in ram.Available)
    {
        Console.WriteLine($"  {available}");
    }
}
		

Retrieving HDD Information

List<HDDInfo> hddInfos = hardware.HDDInfos();

foreach (HDDInfo hdd in hddInfos)
{
    Console.WriteLine($"HDD: {hdd.Name}");
    
    foreach (string temp in hdd.Temperature)
    {
        Console.WriteLine($"  {temp}");
    }
    
    foreach (string load in hdd.Load)
    {
        Console.WriteLine($"  {load}");
    }
    
    foreach (string data in hdd.Data)
    {
        Console.WriteLine($"  {data}");
    }
}
	   

Data Format

All data is returned as formatted strings with consistent alignment. Each value includes:

  • A descriptive label
  • The current value
  • The maximum value (where applicable)
  • The appropriate unit (°C, %, MHz, GB, etc.)

Example output format:

CPU Core #1        3400.0 MHz  Max: 4200.0 MHz
CPU Temperature    45.0°C      Max: 85.0°C
		

Best Practices

  • Refresh Data Regularly: Call the Refresh() method before retrieving data to ensure you get current readings.
  • Handle Exceptions: Wrap calls in try-catch blocks as hardware access might fail on some systems.
  • Cache Expensive Operations: Some operations like getting CPU core count don't need to be called frequently.
  • Dispose Properly: The Hardware class should be disposed when no longer needed (implements IDisposable).

Performance Considerations

  • The library performs hardware polling when you call Refresh() or access sensor data.
  • Frequent refreshes may impact system performance - consider an appropriate refresh interval (e.g., 1-5 seconds).
  • The first data retrieval after initialization may take slightly longer as hardware is initialized.

Copyright (c) 2015 - 2025 Ari Sohandri Putra. All rights reserved.
License terms

E-Mail
arisohandriputra@gmail.com
dev.miw@alternet.com
Quick Access
Homepage
Screenshot
User Guide
SDK Documentation * Active
Tag
Hardware Microsoft Windows CPU GPU RAM HDD Display Monitor Clock Load Temperature Power