CPU Temperature

Hello all,

I was wandering if anyone could point me in the right direction for detecting CPU core temperatures for MAC and Windows within Xojo,

I can see with MBS this can be done for MAC, but what about windows, should I rely on WMIC?

Thank you

I would check WMI.
e.g. with MBS there is a WMI Query example where you can try several queries to see if you find details you need.

Not sure if this will work. But have a try with this one:

For Windows Vista and upwards Only:

  // INFO:
  // http://library.wmifun.net/cimv2/win32_temperatureprobe.html
  //
  //http://msdn.microsoft.com/en-us/library/aa394493%28v=vs.85%29.aspx
  
  Dim locator, objWMIService, objs, objProperty  As OLEOBJECT
  Dim nobjs as Integer
  
  //  Connect to WMI
  locator = new oleObject("WbemScripting.SWbemlocator", true)
  
  Dim wmiServiceParams(2) as variant
  wmiServiceParams(1) = "."
  wmiServiceParams(2) = "root\\cimv2"
  
  objWMIService= locator.invoke("ConnectServer", wmiServiceParams)
  
  // Run the WMI query
  objs = objWMIService.ExecQuery ("SELECT * FROM Win32_TemperatureProbe")
  
  nobjs = objs.count - 1
  
  //msgbox ("Number of Objects: " + str(nobjs +1))
  
  For i as integer = 0 to nobjs
    Dim stringData As String
    
    objProperty = objs.ItemIndex(i)
    // ItemIndex() is not supported in Windows XP only from Windows Vista and upwards
    
    stringData = "Accuracy: " + objProperty.Value("Accuracy") + EndOfLine _
    + "Label: " +  objProperty.Value("Label") + EndOfLine _
    + "Availability: " +  objProperty.Value("Availability") + EndOfLine _
    +"Caption: "  + objProperty.Value("ConfigManagerErrorCode") + EndOfLine _
    + "ConfigManagerErrorCode: " +  objProperty.Value("BlockSize") + EndOfLine _
    + "ConfigManagerUserConfig: " + objProperty.Value("ConfigManagerUserConfig") + EndOfLine _
    + "CreationClassName: " + objProperty.Value("CreationClassName") + EndOfLine _
    + "CurrentReading: " + objProperty.Value("CurrentReading") + EndOfLine _
    + "Description: " + objProperty.Value("Description") + EndOfLine _
    + "DeviceID: " + objProperty.Value("DeviceID") + EndOfLine _
    + "ErrorCleared: " + objProperty.Value("ErrorCleared") + EndOfLine _
    + "ErrorDescription: " +  objProperty.Value("ErrorDescription") + EndOfLine _
    + "InstallDate: " +  objProperty.Value("InstallDate") + EndOfLine _
    + "IsLinear: " +  objProperty.Value("IsLinear") + EndOfLine _
    + "LastErrorCode: " + objProperty.Value("LastErrorCode") + EndOfLine _
    + "LowerThresholdCritical: " + objProperty.Value("LowerThresholdCritical") + EndOfLine _
    + "LowerThresholdFatal: " + objProperty.Value("LowerThresholdFatal") + EndOfLine _
    + "LowerThresholdNonCritical: " + objProperty.Value("LowerThresholdNonCritical") + EndOfLine _
    + "MaxReadable: " + objProperty.Value("MaxReadable") + EndOfLine _
    + "MinReadable: " + objProperty.Value("MinReadable") + EndOfLine _
    + "Name: " + objProperty.Value("Name") + EndOfLine _
    + "NominalReading: " + objProperty.Value("NominalReading") + EndOfLine _
    + "NormalMax: " + objProperty.Value("NormalMax") + EndOfLine _
    + "NormalMin: " + objProperty.Value("NormalMin") + EndOfLine _
    + "PNPDeviceID: " + objProperty.Value("PNPDeviceID") + EndOfLine _
    + "PowerManagementCapabilities: " + objProperty.Value("PowerManagementCapabilities") + EndOfLine _
    + "PowerManagementSupported: " + objProperty.Value("PowerManagementSupported") + EndOfLine _
    + "Resolution: " + objProperty.Value("Resolution") + EndOfLine _
    + "Status: " + objProperty.Value("Status") + EndOfLine _
    + "StatusInfo: " + objProperty.Value("StatusInfo") + EndOfLine _
    + "SystemCreationClassName: " + objProperty.Value("SystemCreationClassName") + EndOfLine _
    + "SystemName: " + objProperty.Value("SystemName") + EndOfLine _
    + "Tolerance: " + objProperty.Value("Tolerance") + EndOfLine _
    + "UpperThresholdCritical: " + objProperty.Value("UpperThresholdCritical") + EndOfLine _
    + "UpperThresholdFatal: " + objProperty.Value("UpperThresholdFatal") + EndOfLine _
    + "UpperThresholdNonCritical: " + objProperty.Value("UpperThresholdNonCritical") + EndOfLine 
    
    msgbox stringData
  Next
  
  locator = Nil
  
exception err as oleexception
  msgbox err.message

so the query is: “SELECT * FROM Win32_TemperatureProbe”. Thanks John.

Thank you I will give both of these solutions a try! :slight_smile: