Hope someone with windows VB declares experience can help with this.
DrDAQ is an educational DAQ card with a number of inputs/outputs.
It comes with a DLL (USBDrDAQ.dll) for use with VB and VBA and Excel.
Unfortunately, it only comes with an Excel VBA example which made it more difficult for me (beginner) to convert to Xojo.
going through as many resources I could find, I managed to read and control most of the functions of the unit with the DLL provided and most of the declares converted, which was very pleasing knowing what one can accomplish with Xojo.
With this projects I gain considerable knowledge on how to apply declares from VB to Xojo. I had no problems with integers but when it came to strings I got a bit lost. I download Implement Declares with Xojo on Windows By Eugene Dakin but found that my understanding on the strings need more work. I am hoping with this real life example it will boost my understanding.
After all that, here is the declare I have problem with the VBA Declare is:
Declare Function UsbDrDaqGetUnitInfo Lib “USBDrDAQ.dll” (ByVal handle As Integer, ByVal S As String, ByVal stringLength As Integer, ByRef requiredSize As Integer, ByVal info As Long) As Long
The long is changed to Int32 which worked for all other declares but this declare had ByVal S As String which Xojo did not except and said t use CString etc.
The following is in the VBA
Dim handle As Integer
Dim Row As Integer
Dim requiredSize As Integer
Dim S As String * 255 (I could not find how to convert this to Xojo)
’ Get the unit information
Cells(10, “L”).value = “Unit opened”
SLegnth = UsbDrDaqGetUnitInfo(handle, S, 255, requiredSize, 3)
Cells(11, “L”).value = S
SLegnth = UsbDrDaqGetUnitInfo(handle, S, 255, requiredSize, 4)
Cells(12, “L”).value = “Serial number:”
Cells(12, “M”).value = S
SLegnth = UsbDrDaqGetUnitInfo(handle, S, 255, requiredSize, 0)
Cells(13, “L”).value = “Driver version:”
Cells(13, “M”).value = S
Note: the SLegnth is declared anywhere but works in the Excel VBA, is it a VB specific function?
Hoping someone can help get these 3 calls to 3 textfields.