Search the Community
Showing results for tags 'open hardware monitor'.
-
Hi guys, I'm trying to use the Open Hardware Monitor library to read some values about the hardware. I know that I could run directly OpenHardwareMonitor.exe and read from WMI but I want to use the library. It is written in C# but I've read from >this topic I can use RegAsm to register the types in the registry so I could run the classes in the library as COM objects. I've downloaded the source, changed COMVISIBLE property to TRUE and compiled the library with MSBuild.exe I would convert this (or this) script to Autoit but after some lines of code I get an error: "Invalid pointer". I don't understand why I get that error, I don't think it's cause RegAsm because it gives me a warning but then it does its job registering the types. #RequireAdmin $RegAsm_path = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm" ; CHECK YOUR VERSION!!! $foo = Run($RegAsm_path & " /codebase /nologo OpenHardwareMonitorlib.dll", "", @SW_HIDE, 0x2 + 0x4) $std = _Read_Std($foo) MsgBox(0,$foo,$std) $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $cp = ObjCreate("OpenHardwareMonitor.Hardware.Computer") If IsObj($cp) Then MsgBox(0,"OpenHardwareMonitor.Hardware.Computer","Object created") $cp.Open() ; <--------------- ERROR RunWait($RegAsm_path & " /nologo /unregister OpenHardwareMonitorlib.dll", "", @SW_HIDE) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Script line is: " & $oMyError.scriptline) RunWait($RegAsm_path & " /nologo /unregister OpenHardwareMonitorlib.dll", "", @SW_HIDE) Exit Endfunc Func _Read_Std($handle) Local $s While 1 $s &= StdoutRead($handle) If @error Then ExitLoop $s &= StderrRead($handle) If @error Then ExitLoop WEnd Return $s EndFunc I'll attach the compiled dll but you need to check .NET Framework folder first. Thank you at all.
- 16 replies
-
- OpenHardwareMonitorLib.dll
- open hardware monitor
-
(and 2 more)
Tagged with: