How to get CPU temperature with Open Hardware Monitor?

1k Views Asked by At

So I've been trying to get CPU temperature on windows, msvc, at last I found Libre Hardware Monitor, fork of Open Hardware Monitor.

And someone(Get CPU Temperature) said he used lhwm-wrapper(https://gitlab.com/OpenRGBDevelopers/lhwm-wrapper) so it can be used with c++.

There is three functions this lhwm-wrapper exports:

GetHardwareSensorMap()
//returns a map

GetSensorValue(std::string identifier)
//returns float

SetControlValue(std::string identifier, float value)
//void function

So I've been curious about how to use this functions to get CPU heat, I think I should use GetSensorValue(std::string identifier) to access but I don't know what to input. Maybe CPU's heat sensor's value I have completely no idea.

I created a visual studio project where I can use lhwm-wrapper, and tried to give some values to GetSensorValue(std::string identifier)

like this:

#include <iostream>
#include <lhwm-cpp-wrapper.h>

int main()
{
    std::cout << LHWM::GetSensorValue("0");
}

whatever I gave as input outputed as 0.

0

There are 0 best solutions below