Just messing around with it, this is what it looks like might be on the right track.. You need pointers to the functions, and the array has to be a DLLStruct.. I was lazy and didnt' declare most variables though. And I can't test it..
Dim $DLL = DllOpen('nvapi.dll')
$N = NvAPI_Initialize()
ConsoleWrite("Return = " & $N & ", @error = " & @error & ", @extended = " & @extended & @CRLF)
$R = NvAPI_EnumPhysicalGPUs()
_ArrayDisplay($R)
For $i = 0 To 100
NvAPI_GPU_GetUsages($R[0])
Sleep(1000)
Next
DllClose($DLL)
Func NvAPI_QueryInterface($nInterface)
$result = DllCall($DLL, "ptr:cdecl", 'nvapi_QueryInterface', 'int', $nInterface)
If @error Then Return SetError(2,@error,0)
If $result[0] = 0 Then Return SetError(3,0,0)
Return $result[0]
EndFunc
Func NvAPI_Initialize()
Static Local $pInitialize = 0
If $pInitialize = 0 Then
$pInitialize = NvAPI_QueryInterface(0x0150E828)
If $pInitialize = 0 Then Return SetError(@error,@extended,0)
EndIf
$result = DllCallAddress("int:cdecl", $pInitialize)
If @error Then Return SetError(2,@error,False)
Return $result[0]
EndFunc
Func NvAPI_EnumPhysicalGPUs()
Static Local $pEnumPhysGPUs = 0
If $pEnumPhysGPUs = 0 Then
$pEnumPhysGPUs = NvAPI_QueryInterface(0xE5AC921F)
If $pEnumPhysGPUs = 0 Then Return SetError(@error, @extended, 0)
EndIf
$stGPUHandles = DllStructCreate("ptr gpuHandles[64];")
$result = DllCallAddress("int:cdecl", $pEnumPhysGPUs, 'ptr', DllStructGetPtr($stGPUHandles), 'int*', 0)
If @error Then Return SetError(2,@error,0)
If $result[0] Then Return SetError(3,0,0)
$nGPUCount = $result[2]
Dim $result[$nGPUCount]
For $i = 1 To $nGPUCount
$result[$i - 1] = DllStructGetData($stGPUHandles, 1, $i)
Next
Return $result
EndFunc
Func NvAPI_GPU_GetUsages($vGPUHandle)
Static Local $pGetUsages = 0
If $pGetUsages = 0 Then
$pGetUsages = NvAPI_QueryInterface(0x189A1FDF)
If $pGetUsages = 0 Then Return SetError(@error, @extended, 0)
EndIf
$stGPUUsages = DllStructCreate("uint gpuUsages[34];")
DLLStructSetData($stGPUUsages, 1, BitOR(34 * 4, 0x10000), 1)
$result = DllCallAddress("int:cdecl", $pGetUsages, 'ptr', $vGPUHandle, 'ptr', DllStructGetPtr($stGPUUsages))
If @error Then Return SetError(2,@error,0)
If $result[0] Then Return SetError(3, 0, 0)
Return DllStructGetData($stGPUUsages, 1, 4) ; 4 is equivalent to c's array[3]
EndFunc
*edit: Fixed parameters and parameter return check (non-zero is error).. AND indexing. Still not sure its entirely kosher though