using XOJO with Measurement Computing's universal library

Is anyone using Measurement Computing’s universal library with XOJO. The support docs for this list VB and VB.net as supported programming languages. It seems to use a DLL in the library (MccDaq.dll).

https://www.youtube.com/watch?v=-rsmZM3UXCk#t=102
www.mccdaq.com/ul

Could XOJO work with this library?

Looking at some of the online documentation it appears that it might. The only way to tell for sure is against it.

How do you open the MccDaq.dll in Xojo for use? I need this information if anyone knows how. Thanks!

Use Declares. A typical declare looks like

Declare Function SomeFunction Lib “MccDaq.dll” (param1 as integer, param2 as CString) as integer

dim p1 as integer = 123
dim p2 as string = “xyz”
dim result as integer
result = SomeFunction(p1, p2)

Is there a way to see the methods inside the dll and read the code?

Found the docs on the library. Thanks.

[quote=198117:@Tim Hare]Use Declares. A typical declare looks like

Declare Function SomeFunction Lib “MccDaq.dll” (param1 as integer, param2 as CString) as integer

dim p1 as integer = 123
dim p2 as string = “xyz”
dim result as integer
result = SomeFunction(p1, p2)[/quote]

Tim, how do you path to the MccDaq.dll file where it’s located on the computer?

Also, how do I create a class reference using the dll so I can do something like this vb code?

Dim mydaqboard As New MccDaq.MccBoard(0)

I’m not getting anywhere on this at all. Here is the VB code, partially converted for Xojo, I’m trying to use:

Button Action:

' How do I add the library to make this work?
' Soft Declare Function MccDaq Lib "C:\\Program Files (x86)\\Measurement Computing\\DAQ\\MccDaq.dll" 

Dim mydaqboard As New MccDaq.MccBoard(0)
Dim dataval As Int16
Dim engunit As Single

mydaqboard.AIn(0, MccDaq.Range.Bip10Volts, dataval)
mydaqboard.ToEngUnits(MccDaq.Range.Bip10Volts, dataval, engunit)
msgBox str(engunit)

I need to alter the above code using the MccDaq DLL somehow to make this work. How do I do this???

I don’t know if this kind of access is supported in Xojo or not.

Thanks Tim. I need to figure out something. Can you offer any suggestions or workarounds? I’ve installed VB Studio 2010. Is there anything I can create to use with Xojo somehow using the dll in VB?

Looking at “Universal Library Language Interface” doc at the end there are two examples: “VB Application using using the UL” and “VB Application using the UL for .NET”.

It is better to use the functions described in “VB Application using the UL” because they works with Xojo.
The object model used by the .NET example does not map directly to the Xojo object model.

So use:
ULStat = cbAIn(Board, Channel, Range, DataValue)

instead of:
ULStat = Board0.AIn(Channel, Range, DataValue)

Regards.

Thanks, I’ll give it a shot.

Maurizio, I still don’t understand how to reference the MccDaq.dll into my Xojo app? How is this accomplished to even be able to use those non .NET coding examples?

For each function you use you must create a “soft declare …” with the function name and related parameters.

For example the function cbAIn:

Const libname As String = “C:\Program Files (x86)\Measurement Computing\DAQ\MccDaq.dll”
Soft Declare Function cbAIn lib libname (BoardNum As Integer, Channel As Integer, Range As Integer, ByRef DataValue as UInt16) As Integer

Regards.

[quote=117998:@Doug Johnson]Is anyone using Measurement Computing’s universal library with XOJO. The support docs for this list VB and VB.net as supported programming languages. It seems to use a DLL in the library (MccDaq.dll).

https://www.youtube.com/watch?v=-rsmZM3UXCk#t=102
www.mccdaq.com/ul

Could XOJO work with this library?[/quote]
You can create a VB class library referencing the MccDaq.dll and access functions that call the MccDaq classes using this method.

https://forum.xojo.com/23931-accessing-net-code-from-xojo-using-vb-is-possible

Hi Ryan,
there are some advantages using this way?
I never used this mixed environment so I don’t know if this workflow can help.

Regards.

[quote=199343:@Maurizio Rossi]there are some advantages using this way?
I never used this mixed environment so I don’t know if this workflow can help.[/quote]

It probably can. Xojo requires DLL to expose Com objects, where VB is able to use methods that Xojo won’t see.

So in fact you could use a VB DLL as an interface that provides the necessary COM objects to methods in MccDaq.dll. An adaptor of sorts.

You may also want to have a peek at the links Ryan posted to see how Xojo manages to access methods in a VB DLL. It is possible they work directly for MccDaq.dll.

But this require to have another development environment to write another piece of software.
Or, maybe, I’m missing something?

[quote=199343:@Maurizio Rossi]Hi Ryan,
there are some advantages using this way?
I never used this mixed environment so I don’t know if this workflow can help.

Regards.[/quote]
As Michel said you can use this method to access the MccDaq.dll functions as methods from Xojo directly. You just have to create your own VB class libraries with a MccDaq.dll reference and the COM identifiers like in the example from the link I posted above.