ActiveX wrapper for Labview
Hello!
My name is Daniel. I'm from Argentina and I work in Tracnova S.A.
Tracnova is the Distributors of NI in Argentina.
I am having an issue with ActiveX development for wrapper an dll driver.
I have to read strain gage aquisition data from an USB device of MANTRACOURT (http://www.mantracourt.co.uk/products/wireless-telemetry).
The manufacturer provide an dll driver. It's shipped with example for VB6 that I have been testing and it works fine.
BUT I HAVE TO USE IT IN LABVIEW.
My first problem is that I have to provide an CALLBACK function pointer as parameter to "INITIALISE" function of the dll. Here is an excerpt from the
example that is shipped (Excerpt from a form module):
Private Sub Form_Load()
'we will only handle base station addresses of 1
iBaseAddress = 1
Caption = Caption & " [DLL v" & VERSION & "]"
CLOSEPORT
'set the callback so we can receive data provider packets
Init AddressOf CallBack ''''''----------------->>>>>>>>>>>>>>>> CALLBACK function pointer as parameter to "INITIALISE" (It defined as Init)
'Open USB interface
ok = OPENUSB
If ok <> 0 Then
ShowMessage "Cannot open USB interface!" & vbNewLine
End If
End Sub
"CallBack" function is contained within .bas. Because You can only retrieve the address to a function or sub (public or private) contained within a
Standard VB Module. There's no way around this.
Here is an excerpt from the example that is shipped (excerpt from a Standard Module):
Sub CallBack(ByRef StringPtr As Long, Length As Long)
Dim PBMsg As String, rc As Long, pEnd As Long
Dim p(128) As Byte
Dim cH As Byte
Dim tID As Long
Dim C As Integer
On Error Resume Next
CopyMemory p(0), ByVal StringPtr, Length
PBMsg = Left$(StrConv(p(), vbUnicode), Length)
'strip off the base station wrapper
PBMsg = Mid$(PBMsg, 4, Len(PBMsg) - 5)
If PBMsg <> "" Then
Debug.Print CVStr2HEX(PBMsg)
Select Case Asc(Mid$(PBMsg, 1, 1)) And &H1F
Case PT_DATA_PROVIDER
'pass data to the main form if we are not closing
If Not Closing Then MainFrm.ShowMessage "DATA_PROVIDER Data Tag=" & Replace$(CVStr2HEX(Mid$(PBMsg, 2, 2)), " ", "") & " Data=" & Decode
(Mid$(PBMsg, 5, Len(PBMsg) - 6)) & vbNewLine
End Select
End If
End Sub
Then, when an data packet arrived, the driver call to "CallBack" function instead, so I can process it and do what I need.
But I can't pass pointer to function IN LABVIEW WITH "LOAD LIBRARY FUNCTION". So I did an ActiveX in VB6 for wrapping the dll of the driver. I attached the
files tha I did. The ActiveX sends an event to labVIEW everytime that a data packet arrived. I trigger an event inside the CallBack function that it's
not working, but if outside (look inside Iniciar() function where I wrote "This is the first event", the event trigger works.)
Why is not THE CALLBACK FUNCTION TRIGGERING THE EVENT INSIDE THE LABVIEW??
I also tried to make a Win32 DLL with C + + using PostLVUserEvent, but neither worked for me. I can send the code in C + + if you want to review.
Thank you for your consideration. I look forward to hearing from you.
Best Regards
Daniel Lopez
Design Engineer
TRACNOVA SA
www.tracnova.com
Attachments:
ActiveXPropia.zip 459 KB
Thanks a lot nyc for your kind reply.
Yes, you are right. They have COM driver, but the event does not fire in labview. Also, this driver does not implement a COM circular buffer which means that if you delay reading and processing the data, these are lost because they are rewritten. I have been asking for support to MANTRACOURT, but after several attempts, they told me they do not provide support for labview only for VB, VBA excel, and some other more, not even C + +
National I miss to much. Nice technical support !
Please help, I need to fix this issue
Thanks a lot!
Daniel
Similar Messages
-
Anyone looked at this yet and have any impressions?
OpenCV wrapper for LabVIEW
DonThis discussion is a bit old but at the time some people tried it out. And this.
Hope this helps
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!" -
hi,
I am using usb can module systec for sending/receiving can messages to device using third party dll.
without using dll can i read/write can messages using labview?
thanksHello,
It sounds like you are using a third party
USB-CAN device. In order to use this device in LabVIEW, you must make
those dll calls unless there are LabVIEW drivers or libraries available.
Even the NI-CAN drivers used for National Instrument CAN devices are just wrappers around dll calls.
Hope this helps.
Peter Flores
Applications Engineer -
Nivbai activex call to labview missing step result's?
I'm traying to call NIVBAI script in labview using activex calls to get step measurment information. For some steps
I'm geting good valuses, but for some steps in vision builder script wher I'm using calculator or global variable, the values of steps are 0.
can someone advise me how to correct that problem? attached picture explains my problem. sorry for may englisch.
Thank's in advance!
Attachments:
problem.PNG 39 KBHi antz24,
Which version of LabVIEW are you using? This example was developed and verified for Visual c++ 6.0 and LabVIEW 7.1. If you are using a different version of LabVIEW, it is likely that the ActiveX methods have changed. Below are the ActiveX methods for LabVIEW 2012:
http://zone.ni.com/reference/en-XX/help/371361J-01/axprop/vi_class_method/
Here is some documentation on calling LabVIEW VIs using different programming languages.
http://www.ni.com/white-paper/5719/en#toc1
Also, what exactly is it that you are trying to do? In most cases, your application would probably be best served if it interfaced with your LabVIEW VI as a DLL.
Andrew T.
National Instruments -
Has anyone developed Labview ActiveX interface for Newport Electronics iSeries process meters?
I am needing to obtain readings from a Newport Electrtonics iSeries strain gauge meter. ActiveX controls are available for the device. However, I am just learning ActiveX controls within Labview and I'm not having any luck. Any Labview examples specific to the iSeries device would be greatly appreciated.
The model of the meter is i8SL33-EI.
Thanks,
RSJust take a look in LV examples to see haw to access methods and properties (even events) and then try with your control.
If this control has a GUI, you better put it in a container rather then using the reference (it's easier to check the functionality).
p.s.: make sure that your control is properly registered (if you don't have an installation program for it, use regsvr32.exe to do it) -
Is LabVIEW able to create ActiveX Object for other sw to use?
I would like to create some ActiveX object from LabVIEW that VB could use it. How do I do it? I only find info about labVIEW use ActiveX created by other SW. Please let me know if LabVIEW has such ability. Thanks.
You cannot create a new kind of ActiveX object in LabVIEW, but you can use ActiveX to control LabVIEW (or a LabVIEW-built EXE) and run your VIs programmatically from other development environments.
Below is a modified excerpt from an example provided by NI on running a LabVIEW VI from Visual Basic:
Dim lvapp As Object
Dim vi As Object
Dim paramNames(4), paramVals(4)
Set lvapp = CreateObject("LabVIEW.Application")
viPath = lvapp.AppDir + "\examples\apps\freqresp.llb\Frequency Response.vi"
Set vi = lvapp.GetVIReference(viPath)
vi.FPWinOpen = True
paramNames(0) = "Amplitude"
paramNames(1) = "Number of Steps"
paramNames(2) = "Low Frequency"
paramNames(
3) = "High Frequency"
paramNames(4) = "Response Graph"
paramVals(0) = cwnAmplitude
paramVals(1) = cwnNumSteps
paramVals(2) = cwnLowFreq
paramVals(3) = cwnHighFreq
' paramVals(4) will contain the value of Response Graph after running the vi.
Call vi.Call(paramNames, paramVals) -
How to implement an ActiveX server in LabVIEW
My task is to implement an ActiveX server in LabVIEW 8.0 that will be called from a data management software (DXE).
The LV server will take care of data acquisition and control.
I have been looking for tutorials and example code at the NI developer zone and elsewhere without any progress. Information is either to general or code is to old (LV 5.1) to give any help.
Please, show me to a good example of an ActiveX server in LV 8 properly commented or with attached explanations.
Alternatively, suggest any tutorial, short course or books with practical instructions.
Specific information is most welcome.
I suppose that it is possible to write a ActiveX client in LabVIEW to verify the functions of the ActiveX server ?rolfk wrote:
skalis wrote:
Thank You. Good to know that I am on the right track.
However,
Your sentence "If You look at the several shipping examples..." make me
little concerned. I am not able to find any example of a LV ActiveX
server in my LV 8.0 installation. I would be very grateful of You can
send me any.
Basically you can not create your own
Active X server with your own object hierarchy and methods in LabVIEW.
LabVIEW however can export a predefined Active X server interface that
is just another access method to its internal VI server interface.
With this interface you can determine what VIs are available to
control, load specific VIs from disk if you know their path and,
execute those VIs and passing parameters to it and receiving outputs.
So if your software allows you to script the Active X access to an
Active X server in some ways such as VBA or similar you should be fine.
If your software expects a specific Active X interface you have to
implement in the server application, you are out of luck with LabVIEW,
without using an external component such as an extra Active X server
DLL that translates between the expected interface and the exported
LabIVEW interface. But this last method is quite likely not worth the
hassle.
Rolf Kalbermatter
While I did follow the link mentioned above and found the Interop.LabVIEW.dll that is included in the C# project for the purpose of calling VIs from C#, I am frustrated that these methods are 'buried' in a .dll that you have to go and find on the NI web site, and are not ActiveX methods that are available in an ActiveX Object that is installed when you install LV 8.20 PDS.
Rolf, I don't know that you will get this email, but are you refering to the methods inside of the Interop.LabVIEW.dll in what you are saying above, and if so, how did you become aware of this .dll?
Is anyone aware of any documentation for these ActiveX methods?
Thanks,
Wes
Wes Ramm, Cyth UK
CLD, CPLI -
Problems with ActiveX Callbacks in LabVIEW 7
Have encountered an interesting problem with ActiveX "Reg Event Callback" in LV7 (WinXP):
In a nutshell, when a lot of events fire in rapid succession, the user-interface locks up.
The events still fire, and the front panel controls update, but the front panel will not respond to clicks. Interestingly, if the block diagram is open, you can stop it and turn on execution highlighting, etc...
- I've discovered that the problem we're encountering is related to multiple events firing before the (reentrant) callback VI has finished executing from the 1st event.
- by watching the Performance data in task manager, and tracking the # of handles used by LabVIEW, I find that when this happens, the # of handles increases, b
ut never decreases until you stop the VI
- I would expect several (nearly) instantaneous events to launch multiple copies of that callback VI, and I can believe that would increase the # handles, but I would expect that LabVIEW would catchup shortly thereafter and the # handles would return to its starting count.
As an aside, using the old ActiveX event and callback method with the exact same version of the activeX control does not have this problem, events just queue up and then fire appropriately.
Anyone seen anything like this?
Anyone (NI guys) have any ideas?
Follow up question (NI guys): when will the support for the old ActiveX event stuff dry up?
Thanks in advance,
Ben
Ben Zimmer
[email protected]
Software Developer
Meikle AutomationHi Ben,
The error message warns about the use of three ActiveX Event VIs that will no longer be supported in future versions of Labview. Following version 6 of Labview, the use of ActiveX Event VIs is shifting to the use of Register Event Callback VI instead. In looking at your screenshots, I did not see any use of the older ActiveX Event VIs. If possible, try attaching the actual VI to the post and I will take a look at that.
At least in terms of support, phone support currently exists for Labview 6 and 7. With the release of Labview 8, support for Labview 6 will slowly be phased out. In this case, phone support for the ActiveX Event VIs will no longer continue as they are no longer included in the versions of Labview for
which phone support is provided. However, Discussion Forums and web-based resources would be your best venue of support for those features.
I would strongly recommend that you migrate to replacing ActiveX Event VIs to using the Register Event Callback VI. The following is a KnowledgeBase article describing the transition of ActiveX in Labview:
Migrating from the ActiveX Event VIs to Using the Register Event Callback Node
Also, are you using the Automation Open/Close VIs? These two VIs will allow acquire/release informatio nof the ActiveX object. I have attached a couple example programs that are included in Labview to help demonstrate this concept.
Hope this helps!
Kileen Cheng
Applications Engineer
National Instruments
Attachments:
ActiveX_Event_Callback_for_Excel.llb 944 KB
ActiveX_Event_Callback_for_IE.llb 972 KB -
Slow imc COM (ActiveX)-libraries inside LabView
Hi
I'm using the imc COM (ActiveX)-libraries inside labview. The key command is the "automation open" block from LabView and selecting the desired ActiveX class.
Here his the definition of one of this function:
Function DChannel.GetDataDouble( StartIndex As Long, Count As Long,
Data As Double() ) As Long
Copies the specified samples in an array of 8Byte real numbers.
Parameters
StartIndex
Index of the 1st sample to copy. The first sample in a channel has an index of 1.
Count
Number of samples to copy.
Data
Array to receive the values. See remarks section.
Return Value
Number of valid samples in <Data>. May be smaller than <count>, when there are not enough samples in the channel (StartIndex + Count -1 > Length).
The problem and also question is why the parameter Data apears as a variant when I use a invoke node for the above method (should be double()??)
When using large Data arrays the libraries are very slow in comparison with VB6. I tested the same functions in VB6 and LabView. In VB6 the COM libraries are very fast! Does anybody know how to improve performance with COM Variants?
Thank youI'm not sure you can do anything about the speed as long as you use ActiveX. At least that was the answer I got when I asked a similar question here. It seems that there is a lot of data copying between memory spaces that goes on between ActiveX and LabVIEW and, if there is much data involved, it can take a while. Search these forums for the terms safearray or "safe array" or marshal data and you will find more info on what you are up against.
-
Import excel data for labview control
I'm having some trouble importing excel data into labview. Goals: Input valve flow rates into excel, use those values to control DAQ, have user balance odor with excel defined flow rate, export balance data to excel. Here is what I have so far. Any help is greatly appreciated.
Attachments:
Intensity.vi 162 KBWhere in the code are you reading from the Excel Spreadsheet? What VIs are you using? What are the problems are you experiencing (errors, unexpected values, etc.)?
There is a Read From Spreadsheet File.vi in LabVIEW. LabVIEW uses ActiveX controls for .xlsx files, so saving the spreadsheet as a CSV file may be better for this VI. Try it out! See what happens.
Here some more info on reading from spreadsheets:
LabVIEW Manual: Read From Spreadsheet File VI
KnowledgeBase article: How Can I Import Spreadsheet Files into LabVIEW using the .csv Format?
Taylor B.
National Instruments -
Simple Teststand UI API for LabVIEW
Like many people I know how painful it is to program a Teststand user interface in LabVIEW.
To combat that I have developed a new API which wraps the ActiveX calls into modern object oriented code which follows proper LabVIEW programming paradigms.
Please check it out:
https://decibel.ni.com/content/docs/DOC-43511
This is pretty much beta software, so constructive feedback on the code or the article itself is greatly appreciated.Hi holy,
I am not familiar with that instrument, but looking at the spec, it doesn't look like its compatible with IVI.
The product spec says it comes with a driver for labview and probably some example VI's.
Therefore to interface with TestStand you will have to use the LabVIEW adapter rather than the IVI step types.
If you are using TestStand 3.x, then you should be able to interface to the individual driver VI's or create your own higher level function VI and call these using the LabVIEW Adapter.
The driver doesn't appear to be available as a download from the NI website, otherwise I would have created an example sequence file for you.
Hope this offers some help.
Regards
Ray Farmer
Regards
Ray Farmer -
UCalc Fast Math Parser for LabVIEW?
Several customers have been using the uCalc math parser product with LabVIEW. Recently one LabVIEW / uCalc user has attracted my attention to the fact that the new version of uCalc FMP is now harder to use with LabVIEW. Direct support for LabVIEW was never figured into the design of uCalc. It just so happened that the older uCalc version worked with it. Now, I’d like to figure out if there are enough potential uCalc FMP users to make it worth adding direct support for LabVIEW.
uCalc FMP lets you evaluate math expressions that are defined at runtime. You can define functions, operators, and variables, and use them in your formulas. The older version that is easier to use with LabVIEW can be found at www.ucalc.com/mathparser/ucfmp20.zip (you won’t find the old version in the current download page for now).
I myself have no experience with LabVIEW. However, with some 3rd party help, the user who contacted me recently was able to interface the new uCalc version with LabVIEW. Perhaps LabVIEW developers may want to weigh in. Might you be able to create an “official” uCalc FMP wrapper for the current version of uCalc, or give some tips on what it would take for me to do it?
Daniel Corbier
www.ucalc.comIn the previous DLL, I exported a series of functions such as an eval routine that returns the result of evaluating an expression, as in
ucEval("5+4")
which would return 9; a routine to define functions as in
ucDefineFunction("Area(length, width) = length * width")
or variables as in
ucDefineVariable("MyVar = 123")
plus a list of other routines.
The new version was completely redesigned. You can do a lot more. However, one exported function named uCalc() encapsulates most of the component's functionality. Instead of exporting many routines from the DLL, wrappers for routines like ucEval, ucDefineFunction, ucParse, etc., are defined in include files for the supported compilers. On the surface, things run roughly the same for the supported compilers, despite the changes under the hood. But apparently not so for LabVIEW.
ucDefineVariable for instance, which previously was directly exported from the uCalc DLL is now defined as follows in the include file for Visual Basic (classic):
Public Function ucDefineVariable(Definition As String, Optional ItemAddress As Long = 0, Optional ByVal t As Long = 0) As Long
Dim ItemDef$
ItemDef$ = "Var: " + Definition
If ItemAddress Then ItemDef$ = ItemDef$ + " At " + Str$(ItemAddress)
ucDefineVariable = uCalc(uc_Define, ItemDef$, 0, 0, 0, t)
End Function
By the way, what is the link to download the evaluation version of LabVIEW? I found links for the tutorial. And there's a "Test-Drive LabView" link that brings me to an online evaluation version.
Daniel Corbier
www.ucalc.com -
MapPoint ActiveX Control with Labview 7.1
I am looking for a basic example on how to integrate a MapPoint ActiveX control into a Labview vi so I can pull up maps at a given set of lat-long coordinates with zoom in and out capability. I'm new to Labview and activex container use and have not previously attempted to program with MapPoint, but that is what I have to work with. Not finding discussions on MapPoint use with Labview, at either MS site or here, so am looking for assistance to get me started. Using Labview 7.1, MapPoint 2004 and Windows XP.
Hi,
I'm afraid I don't have any experience with MapPoint, but some of the other members might. If so, it would be great if they could post any code they may have...
As a general rule, programming ActiveX is a little tricky since properties and methods aren't always documented well. Furthermore, the ActiveX hierarchies for a particular application can change from revision to revision. This is why programs using activeX to interface with Word or Excel have problems with different versions of Office. If you have to use Map Point, you may want to check MSDN for any information they may have. You may also want to check out the ActiveX examples in the Example Finder by searching for ActiveX. They should give a general understanding of how ActiveX programming is done on the LabVIEW side of things.
If you can use a web based application, it might make your life a little easier. You can specify lat long coordinates in Google Maps very easily. Im attaching a simple application that does this for you. Just enter the lat and long in decimal format and hit run. The resulting map will show up in the container on the front panel and you can pan or zoom to your heart's content. I hope this helps. Good luck with your application and happy holidays!
Regards,
Chris J
Message Edited by ChrisJ on 12-20-2005 05:00 PM
Attachments:
lat long example.vi 33 KB -
Can a "object reference" type from TestStand be used for Labview VIs
I am creating a test sequence in Test Stand and I am looking to use a "object referrence" type stored in the globals of TestStand as an input to VIs that I will use later in TestStand. The object can be from .NET or ActiveX. I need to know if I can use a input that will support either type.
Hi Mcfrenzy36,
Object references can be used for LabVIEW. I have found an article that teaches how TestStand handles Activex object references. Here is the linkt o it:
http://zone.ni.com/devzone/cda/tut/p/id/2984
I hope that this helps.
Regards,
Perry S.
Applications Engineer
National Instruments -
Lost ActiveX connection with LabVIEW server
I have called LabVIEW in TestStand and tried to execute the test cases .
While executing I got the following error: ( Lost ActiveX connection with LabVIEW server.
The LabVIEW adapter will try to reconnect on the next execution attempt.-18001; An error occurred accessing the LabVIEW ActiveX automation server.).Same error. Is anyone from NI going to bother commenting on this? It's been >8 months...
Maybe you are looking for
-
Post Author: lazarus CA Forum: Formula Just want to say that i'm glad this forum exists. Many a late night has been spend trawling the net for solutions to CR issues which ultimately never get resolved. Hopefully this lovely forum can get me and the
-
Converting object wrapper type array into equivalent primary type array
Hi All! My question is how to convert object wrapper type array into equivalent prime type array, e.g. Integer[] -> int[] or Float[] -> float[] etc. Is sound like a trivial task however the problem is that I do not know the type I work with. To under
-
Table rows zebra.. how to make table rows in different colors?
please help?
-
White list of computer part nx7400
Hi Can somebody say mi what is in white list of bios of my nx7400 computer I want replace some part and do not know what will be by white list disabled. Or it is some possibility how to disable white list in my computer. (I have version with drDos
-
I have Kdemod and Gnome but when i am in Gnome i want Nautilus
I have installed kdemod and gnome but when i am in gnome when i go to "Places", all folder are opened with dolphin. But i want to use dolphin when i am in kde4. Is there a way to resolve it?