0

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.

kaan kaya
  • 5
  • 5
  • If you look at [LHWM.cs](https://gitlab.com/OpenRGBDevelopers/lhwm-wrapper/-/blob/master/lhwm-wrapper/LHWM.cs) you see a variable called 'sensors_map'. This variable gets initialized when using the wrapper. Maybe you could try adding a function to the wrapper which prints all the contents of this variable. Because, GetSensorValue uses this 'sensor_map' dictionary. – Xander Dec 05 '22 at 08:51
  • @Xander I printed the map, it just gives my pc components. This is the output for CPU: AMD Ryzen 5 4600H with Radeon Graphics, CPU Core #1, Load, /amdcpu/0/load/1. I think it only helps to create the map – kaan kaya Dec 05 '22 at 09:18

0 Answers0