NVIDIA GPU temperature

KevinPrince

New member
Joined
Oct 19, 2011
Messages
1
Programming Experience
1-3
Hello everyone!

I'm trying to write a small application that will show the GPU temperature.
I'v found the following documentation about the subject:
http://developer.download.nvidia.com...lPanel_API.pdf

according to this documentation, I can use the nvcpl.dll file (which is a part of the NVIDIA driver) like this:

VB.NET:
Function
Prototype
BOOL CDECL NvCplGetThermalSettings
(IN UINT nWindowsMonitorNumber,
OUT DWORD* pdwCoreTemp,
OUT DWORD* pdwAmbientTemp,
OUT DWORD* pdwUpperLimit);
Parameters In UINT nWindowsMonitorNumber -- The display number shown on
the Windows Display Properties->Settings page.
A value of 0 indicates the current primary Windows display device.
DWORD* must be a valid pointer --
pdwCoreTemp -- GPU temperature in degrees Celsius.
pdwAmbientTemp -- Ambient temperature in degrees Celsius.
pdwUpperLimit -- Upper limit of the GPU temperature specification.
Return Values True on success.
False on failure.

Now i wrote this code in VB.NET:

VB.NET:
<DllImport("nvcpl.dll", CallingConvention:=CallingConvention.Cdecl)>
Private Shared Function NvCplGetThermalSettings(ByVal nWindowsMonitorNumber As ULong, ByRef pdwCoreTemp As UInt32, ByRef pdwAmbientTemp As UInt32, ByRef pdwUpperLimit As UInt32) As Boolean
End Function

Public Function Temperature(ByVal monitornumber As Long) As UInt32
Dim core As UInt32
Dim ambient As UInt32
Dim upperlimit As UInt32
If NvCplGetThermalSettings(monitornumber, core, ambient, upperlimit) Then
Return core
Else
Return 0
End If
End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show(Temperature(0))
End Sub

Now the problem is that this code keeps sending back 0, which means somethin is wrong here and the function is not working. It's been two days now and i still can't figure it out :S
I'd really appreciate any help.. thanks alot!
 
Back
Top