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).
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???
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)
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
[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).
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.
[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.
[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.