0

I am trying to use Openhardwaremonitor.dll to read CPU temperature, but not able to get it right.

If cp. = SensorType.Temperature Then
                    Trace.WriteLine([String].Format("{0} Temperature = {1}", sensor.Name, If(sensor.Value.HasValue, sensor.Value.Value.ToString(), "no value")))
                End If

The Error is saying:

Error 4 'OpenHardwareMonitor.Hardware.Sensor' is not accessible in this context because it is 'Friend'.

however a friend function should be accessible as I've imported the DLL in the program.

Please help

SOAMad
  • 325
  • 5
  • 22

2 Answers2

0

You cannot inherit Friend variables from one assembly to another. Try making OpenHardwareMonitor.Hardware.Sensor Public.

xpda
  • 15,585
  • 8
  • 51
  • 82
  • Hi, I may not be able to do that as 'OpenHardwareMonitor.Hardware.Sensor' is pre compiled in DLL from Open Hardware Monitor. Is there any other way or may be Function in the DLL – SOAMad Oct 24 '14 at 18:50
  • Here's an example of Open Hardware Monitor using C#, with declarations -- maybe that will help: http://stackoverflow.com/questions/10495430/how-can-i-use-open-hardware-monitor-source-code-in-c-sharp-i-tried-anything-do – xpda Oct 25 '14 at 00:46
0

Anyways, I get the answer. All we have to make a call to.

getCompleteInfo()

Rest is on manipulation of the output.

SOAMad
  • 325
  • 5
  • 22