Do you know that the Open {Hardware} Monitor DLL supplied with HWMonitor (OpenHardwareMonitorLib.dll) handles the entire heavy lifting inside the utility and can be utilized by builders to energy C#/.NET/ASP tasks with relative ease.
You’ll be able to merely copy this single file, drop it into your c# undertaking, add a reference and you can begin creating system well being purposes in just a few easy steps.

Earlier than we get began, let me introduce myself; I’m Andy, and I shall be your host for the following ten minutes. When you like, you possibly can observe me on Twitter the place I put up about my journey as a know-how author and a contract designer & developer.
You would possibly like: Big Record of Free Overclocking Software program
First up, What’s HWMonitor?

To first perceive the Open {Hardware} Monitor Libray, you first should perceive what HWMonitor does. HWMonitor is a system info & system well being monitoring software program for Home windows and Linux. This free system reporting software program shows info on a variety of your pc {hardware} sensors akin to CPU, RAM, GPU, Followers, laborious drives and even motherboard.
This utility is common amongst overclockers, players, pc {hardware} fanatics, skilled pc technicians and, comes with a number of options that put it a step forward of the competitors for its reporting capabilities.
HWMonitor Key Options
- Trusted inside the neighborhood
- Help for AMD, By way of & Intel Processors
- Help for AMD, ATI & Nvidia GPUs
- Can report frequencies, voltages, temperature and extra.
- Continually up to date with contemporary {hardware} assist
- Professional model contains extra logging capabilities, distant operation, and graphing. (Not required for this text)
On the core, HWMonitor is getting all of its knowledge from the OpenHardwareMonitorLib.dll which is included inside the listing of the downloaded information. This single file is accountable for the entire system well being statistics and system info reported inside the program – fortunate for us, we are able to take the DLL and use it in our personal tasks.
HWMonitor is on the market for everybody to obtain from the CPUID obtain web page with no strings connected.
What System Info can I entry utilizing OpenHardwareMonitorLib.dll?
Now that you just perceive HWMonitor and what its function is, you is perhaps left with a query: what are you able to do with the Open {Hardware} Monitor DLL, and what info does it expose? Right here is every part I may discover.
# | {Hardware} | Info Accessible |
---|---|---|
1 | CPU | Bus Pace, Frequency, Utilization, Temperature, Energy Draw |
2 | GPU | Core Frequency, Reminiscence Frequency, GPU Utilization, Temperature |
3 | RAM | Ram utilization |
4 | Motherboard | Vcore, DRAM voltage, System Temperature, CPU Temperature |
5 | Exhausting Drives | S.M.A.R.T, SSD Put on Degree, Learn/Write |
6 | Followers | Fan Pace |
For this text, I will likely be specializing in fetching the CPU and GPU info, storing them in variables and outputting the values to the console. When you want extra stats akin to motherboard or ram, you should utilize the identical strategies to entry another system info you want.
Integrating the HWMonitor DLL with Visible Studio / C#
Earlier than you possibly can question the DLL and begin fetching info in your C# code, you could undergo some fundamental undertaking arrange to make sure you can entry Open {Hardware} Monitor from inside your undertaking.
Beneath is an summary of the steps required.
Steps Required
- Obtain Visible Studio
- Open Visible Studio
- Begin a New C# Mission
- Extract OpenHardwareMonitorLib.dll
- Add DLL to Visible Studio Mission
- Power your app to run in administrator mode
Lets get began?
1. Obtain Visible Studio
Head over to the Visible Studio web site and obtain the related model. I’m utilizing MAC for programming atm so I downloaded that one.
2. Set up & Open Visible Studio

After getting downloaded Visible Studio, go forward and open the file to begin the set up. As soon as full go forward and open this system.
3. Begin a New C# Mission
Earlier than you can begin writing any code or interacting with HWMonitor, you could arrange a brand new undertaking.
Comply with these easy steps to get began:
- Click on new
- Choose console undertaking
- After, choose .internet framework 5.0
- Give your undertaking a novel title
- Allow GIT when you want model management
- Click on the create button

Along with your C# undertaking arrange and able to go, you could extract the required file and pull it into your undertaking. To do that, obtain HWMonitor, open the zip and transfer OpenHardwareMonitorLib.dll into your new c# undertaking folder.
5. Add DLL to Visible Studio Mission

To begin fetching the system info in our code, you could add the DLL file reference to your visible studio c# undertaking.
Here’s what you could do:
- Click on Mission > Add Reference
- Choose the .internet meeting tab, click on Browse
- Navigate to and choose the copy of OpenHardwareMonitorLib.dll that you just positioned in your undertaking folder
- Hit okay
These important steps guarantee you have got added the required DLL file to the undertaking and that you would be able to now reference it in your undertaking’s information. To learn the way to probe your system and pull important info akin to CPU frequency, load and voltage, transfer on to the following step under, which outlines some sensible examples.
6. Power your app to run in administrator mode
To entry system-level info, you could full one last step designed to allow administrator entry at startup.
- From the undertaking panel, proper click on Mission > Add New and click on Utility Manifest File
- Press Ctrl + Shift + F and seek for “requestedExecutionLevel”
- Change the tag to:
Failure to finish these last steps will end in clean knowledge being returned from OpenHardwareMonitorLib.dll. Sadly, I made this error in my undertaking and spent ages debugging.
Instance Code: OpenHardwareMonitorLib.dll and C#
The above instance will get you up and going with an precise utility that grabs details about your pc’s CPU and GPU and outputs them to a easy console app. In order for you, you possibly can seize this code by way of the Gist.
Earlier than you should utilize this instance code, you will want to arrange a brand new undertaking which I outlined within the earlier step.
Breaking down the Code

The above code is a superb copy and paste instance for knowledgeable builders who know their approach round however, for these of you with rather less programming expertise, this part was made for you.
I’ll break down the instance code and present you step-by-step how every part is working.
1. Embrace a Reference to the DLL
To begin and, earlier than you possibly can entry the {hardware} studies you want, you’ll first want to incorporate a reference to the DLL on the high of your undertaking major file proper after the opposite utilizing statements.
This line of code will allow Visible Studio to entry the performance we’d like in additional steps. Allow us to transfer on.
2. Defining the {Hardware} to Report
To begin grabbing laptop well being stats, we have to outline a brand new pc object uncovered by the Open {Hardware} Monitor DLL. All the pieces we’d like is held inside the pc object, and it is usually the place we outline which {hardware} we wish laptop well being stats reported for.
You’ll discover two settings inside our new pc object; GPUEnabled = true and CPUEnabled = true. These settings inform the Open {Hardware} Monitor library to return knowledge for any processors or graphics playing cards at the moment related to the system. If we don’t outline them right here, we gained’t have any knowledge inside the loop.
In case you’re questioning, here’s a checklist of the choices accessible to the article: new Laptop(){}
.
Full Record of {Hardware} Experiences Accessible
- GPUEnabled – Allow GPU associated statistics and studies
- CPUEnabled – Allow CPU associated statistics and studies
- RAMEnabled – Allow RAM associated statistics and studies
- MainboardEnabled – Allow Motherboard associated statistics and studies
- FanControllerEnabled – Allow Fan associated statistics and studies
- HDDEnabled – Allow Exhausting Drive associated statistics and studies
Now, contemplating we’ve got outlined the pc object, we have to begin a connection between your code and the DLL file.
This single line will startup the DLL and allow it to begin fetching laptop well being standing.
3. The Loop
The loop is the place the magic occurs and is known as each second by the Predominant technique positioned on the backside of the file. This loop makes a name to ReportSystemInfo()
, which matches by all of the accessible knowledge and returns solely the data we’ve got requested.
As you possibly can see, strategies are comparatively straight ahead and it’s so simple as focusing on the right Sensor Kind and Sensor Title.
4. Accessing CPU Info
Contained in the loop, there are two distinct sections masking CPU info and the opposite masking the GPU. Right here we are going to look particularly on the CPU.
5. Accessing GPU Info
After the CPU part, you will see that another part masking system info for each Nvidia and AMD GPUs. The Open {Hardware} Monitor library studies info for each individually, so we have to entry them of their distinctive approach.
Conclusion
This has been fairly a prolonged tutorial. When you adopted alongside and managed to get every part working, pat your self on the again.
The Open {Hardware} Library permits .internet and c# builders to interface with system {hardware} and fetch key info on a spread of {hardware} sensors. This technique may pave the best way for distinctive purposes which are decoupled from the HWMonitor UI. It will allow builders akin to your self to simply create their system well being displays and laptop well being standing displays.