12-22-2008 05:22 PM
Hello,
I have been having difficulty using Labview as an AcvtiveX server. I have reviewed all the postings on this subject and most are either pre Labview 8.2 and thus do not account for the changes made between 8.2 and 8.5 which broke the Activex server functions. I have looked at the recommendations for changing the to code to export (exported vi's in a DLL or Source distribution) and have tried these with no success. The closest example I have found was posted here http://forums.ni.com/ni/board/message?board.id=170&thread.id=283417 the example code they posted does ont work for me and still generates and error 3005.
What i need is simple. I want to turn my applicaiton into a Vi server.. Expose a vi that acceses elements in the Vi server.. (controls, queues, Globals etc) that are in the Vi server context. I would then like to build a vi .. or dll that calls the 'exposed' vi in the vi server to pass data to or from the vi server. The V test.zip example file in the above indicated post is a pretty good example of this .. it just does not seem to work when i build it in 8.5. Are there any GOOD and 'current' examples of using labview as the ActiveX server (Compiled) and calling exposed vis from an external application Labivew, Visual Basic.. etc?? I am only interested in cases where Labview is the Sever. or both client and server.
I have used a tool "ActiveXplorer" to examine the registered "exe" when the viserver is run. It always shows that there is no Type Library associated and the object is not creatable. There is a .tlb created by the project build however, where as the previous version 8.2.1 of Labview did not build that correctly. I have also tried this on 8.6 with similar error 3005 generated. sooooo what am i missing?
Thanks
Louis Ashford
12-22-2008 09:55 PM
There's an example that ships with LV that demonstrates using it as an ActiveX server to pass a waveforn to Excel.
Mike...
12-23-2008 03:06 AM
Mike,
Thank you for your response to my question. The problem is that the example you site does not use the Labview vi as the Server. Excel is actually the vi server and the automation open is using and excel automation object. I am sure that Excel creates proper automation objects .. Labview however does not seem to. So while this example shows how labview can function as a client it is not an example of a compiled Labview Sever being accessed by a 'laview vi'. Possibly I am not looking at the vi that you are thinking of.
The examples i am aware of:
"ActiveX Event Callback for Excel.vi... (Excel is server not Labview vi)
"ActiveX Event Callback for IE.vi (same Labview vi is client)
"Write Table to XL.vi" ( again excel is the server)
"3D Graph Properties - Torus.vi" (accesses an activex Control 'not' and Activex EXE)
"3D Lorenz Attractor Draw at Compeltion using 3D Curve.vi (Uses an activex control not activex Exe server)
"3D Parametric Surface - Ribbon.vi (Uses an activex control not activex Exe server)
"3D Surface Example - Fluctuating Sine Wave.vi (Uses an activex control not activex Exe server)
"Excel Macro Example.vi (Uses excel as automation server..not Labview)
"FamilyTree.vi (uses MSComctlLib.ITreeView object not Labview as server)
"SlideShow.vi" (uses PowerPoint._Application not Laview as server)
Most of the posts I have seen are for versions prior to Labview version 8.2 (where the ActiveX server was broken) I have seen only a few posts that actually address the issue i am talking about. however thus far no real solution has been offered. I get the same results when compiling and testing this with 8.6.. as well. So have you tried this Mike? Possibly i am missing something very simple..
The example i did find and gave the link to is a pretty simple one. This does not work on my machine at all. You can select the automation server that is registered with windows after running the server one time and this then breaks the client vi.. I have found by reselecting the GetViReference property node in the Client vi that it will the 'fix' the client vi as far as labview is concerened and it no longer shows and error. Now when you run the Client vi it will infact find the vi server and will launch it ok. However. The open automation object then hangs.. for quite some time then returns the error
"Error -2146959355 occurred at Server execution failed
in Client_reader.vi" Obviously the automation Exe (server) was seen because it was opened yet it did not return a valid reference so the subsequent property nodes in the client.vi will fail. Something is wrong with Labviews opening of or creating of automation objects..
Thanks,,
Louis Ashford
12-23-2008 08:48 AM
Youi are looking at the wrong example. Inside your LabVIEW directory look in \examples\comm and open the file freqresp.xls. It calls the VI \examples\apps\freqresp.llb\Frequency Response.vi. It demonstrates the ActiveX server operation.
Mike...
12-23-2008 12:41 PM
Mike,
I have looked at the example you have indicated and there are several issues I have with this example. First .. It does not run on my machine .but rather gives an error 6532 "Labview: Vi Server Access denied". I have lowered the macro security in excel to nothing and this error persists, As I examine the visual basic code that is executed in excel:
'
' LoadData Macro
'
' Keyboard Shortcut: Ctrl+l
'
' This is an example to demonstrate LabVIEW's Active-X server capabilities.
' Executing this macro loads a LabVIEW supplied example VI "Frequency Response.vi",
' runs it and plots the result on an Excel Chart.
Dim lvapp As LabVIEW.Application
Dim vi As LabVIEW.VirtualInstrument
Dim paramNames(4), paramVals(4)
Set lvapp = CreateObject("LabVIEW.Application")
viPath = lvapp.ApplicationDirectory + "\examples\apps\freqresp.llb\Frequency Response.vi"
Set vi = lvapp.GetVIReference(viPath) 'Load the vi into memory <------ Fails here
vi.FPWinOpen = True 'Open front panel
----------------------
The code fails as it is trying to aquire a reference to the 'Frequency Response.vi' contained in the DLL. Even if this had worked ok this is not equivilent to what i am trying to do. I have a compiled EXE Vi server that i am trying to access with ActiveX. I dont know what 'Labview.Application' is or where that is defined. Is that a generic Lavbiew ActiveX server? Since there is no project given for this example it leaves me with more questions than answers. What i want to see is a project that builds an activex server (EXE) then shows access to a vi exported from within that Server. I have yet to see working code that does this.. the example you have given does show the method to call the vi server and to access a vi within that from visual basic. That fails on my system as i have indicated above at the point where it would open the vi reference. Does this run on your system ? Under 8.5 or later Labview? If so then i just need to understand why that does not work on my system. I also need to know why the example I originally refferenced does not work .. It seems these may be related.
Thanks again for your response,
:Louis Ashford
12-23-2008 12:56 PM
Yes this example works for me in V8.2.1 and V8.6. Do you have ActiveX enabled for your copy of LV?
Mike...
04-30-2009 05:40 PM
Hi, I'm trying to do the same thing without succed. Do you know how to resolve this?
05-01-2009 12:20 PM
Hi all,
Please make sure, as Mike as mentioned, that ActiveX is enabled in your version of LabVIEW.
Ipshita C.