HardMonLib.dll is a compact and efficient .NET library designed to provide structured and categorized access to system hardware metrics, such as CPU temperature, RAM usage, GPU load, battery health, storage data, and network speed.
This documentation outlines how to integrate and utilize HardMonLib.dll in your application using C#, VB.NET, or any other .NET-compatible language
Key Features
- Retrieve real-time data from CPU, GPU, RAM, storage, battery, and network interfaces.
- Organize hardware data in a hierarchical structure.
- Provides both current and maximum values for sensors.
- Includes human-readable formatting (e.g., °C, %, GB, Mbps).
- Lightweight and easy to integrate.
System Requirements
Component |
Minimum Requirement |
Recommended |
OS |
Windows Vista |
Windows 10/11 |
.NET Framework |
2.0 |
4.0+ |
RAM |
512 MB |
2 GB+ |
Permissions |
User Mode (Basic Data) |
Admin (Full Access) |
Reference the Library
In your project:
- Copy HardMonLib.dll to your project folder.
- Add a reference:
- In Visual Studio, right-click on References → Add Reference → Browse → Select HardMonLib.dll.
Usage Example
C#
using HardMonLib;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
public class MainForm : Form
{
private Hardware monitor = new Hardware();
private void button1_Click(object sender, EventArgs e)
{
List data = monitor.GetAllHardwareData();
foreach (var node in data)
{
Debug.WriteLine($"Hardware: {node.Name} [{node.HardwareType}]");
foreach (var category in node.Children)
{
var cat = (Hardware.SensorCategoryNode)category;
Debug.WriteLine($" - Category: {cat.CategoryName}");
foreach (var sensor in cat.Children)
{
Debug.WriteLine($" {sensor.SensorName}: {sensor.Value} (Max: {sensor.Max})");
}
}
}
}
}
VB.NET
Imports HardMonLib
Public Class Form1
Dim monitor As New Hardware()
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim data As List(Of Hardware.HardwareNode) = monitor.GetAllHardwareData()
For Each node As Hardware.HardwareNode In data
Debug.WriteLine("Hardware: " & node.Name & " [" & node.HardwareType & "]")
For Each category In node.Children
Dim cat = CType(category, Hardware.SensorCategoryNode)
Debug.WriteLine(" - Category: " & cat.CategoryName)
For Each sensor In cat.Children
Debug.WriteLine(" " & sensor.SensorName & ": " & sensor.Value & " (Max: " & sensor.Max & ")")
Next
Next
Next
End Sub
End Class
Class Structure
HardwareNode
Represents a top-level hardware component (e.g., CPU, GPU).
- Name (String) – Display name of the hardware.
- HardwareType (String) – Type of the hardware (e.g., CPU, GPU, Battery).
- Children (List of SensorCategoryNode) – Collection of grouped sensors.
SensorCategoryNode
Represents a logical category of sensors (e.g., Temperatures, Loads).
- CategoryName (String) – The name of the sensor group.
- Children (List of SensorNode) – Individual sensors in this category.
SensorNode
Represents a single sensor reading.
- SensorName (String) – The name of the sensor (e.g., Core #1).
- Value (String) – Current sensor value with units.
- Max (String) – Maximum recorded value with units.
Components Monitored
Component |
Details |
CPU |
Clock speed, load %, temperature, power usage |
GPU |
Load %, temperature, VRAM usage (if available) |
RAM |
Total and used memory in GB |
Battery |
Charge level, health %, voltage, chemistry type) |
Storage |
Temperature, load %, capacity (if supported) |
Network |
Upload/download speed in real-time |
Mainboard |
Name, baseboard info |
Notes
- The network statistics calculate real-time bandwidth based on historical deltas.
- All outputs are returned in string format, suitable for direct display.
Best Practices
- Call GetAllHardwareData() periodically (e.g., via timer) for live updates.
- Avoid querying in tight loops to prevent high CPU usage.
- Safely handle exceptions if certain sensors or hardware are not available.
License terms
Read HardMon License terms here.
Copyright (c) 2015 - 2025 Ari Sohandri Putra. All rights reserved.
License terms |
|