The delphi code looks like this :
private IntPtr _device = new IntPtr(-1);
private readonly byte[] _readVersionCommand = new byte[] { 0, 1, 134, 255, 1, 0, 0, 0, 0 };
byte[] bVersion = new byte[9];
_device = RDing.OpenUSBDevice(UsbVendorId, UsbDeviceId);
RDing.WriteUSB(_device, _readVersionCommand, (uint)_deviceOutputLength, ref numberOfBytesWritten);
RDing.ReadUSB(_device, bVersion, (uint)_deviceInputLength, ref _numberOfBytesRead);
I translated it to :
$b = DllStructCreate("byte[9]") $c = DllStructCreate("word") $cTemp = DllStructGetPtr($c) $e= DllStructCreate("byte[9]") Dim $TemperReadVersionCommand[11] = [0,1,134,255,1,0,0,0,0,0,0] For $I = 0 To 8 DllStructSetData($b,1,$TemperReadVersionCommand[$I],$I+1) Next Global $ghHidFTDll = DLLOpen("RDingUSB.dll") $TemperDevice = DllCall($ghHidFTDll,"bool","OpenUSBDevice","int",3141,"int", 29697)$TemperRequestTemperature = DllCall($ghHidFTDll,"int","WriteUSB","int",$TemperDevice[0],"str",DllStructGetData($b,1),"uint",9,"ptr",$cTemp) $temperReadTemperature = DllCall($ghHidFTDll,"int","ReadUSB","int",$TemperDevice[0],"str*",$e,"uint",9,"ptr",$cTemp)
The first and second DLLCall gives a good result (return code 0).
The second DLL call return an error on the second parameter. (return code 1)
The result should be a 9 byte array in the second parameter ($e).
What do I wrong. How can I pass a variable to write the array to ?
Tanks in advance for your help.