LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Object Handle CAObjHandle to NI LabWindows/CVI Server 2009

Solved!
Go to solution

Is there a way to create a CAObjHandle to the LabWindows/CVI ActiveX Server without opening a new CVI App?

 

A little background, I'm trying to automate the creation of HTML help files from Function panels. Thanks to (http://forums.ni.com/t5/LabWindows-CVI/Is-there-a-way-to-automate-generating-the-documentation-from-... I was able to find that there is a function that exist to accomplish that.

 

 

CVI_AppGenHtmlHelpFromFPFile is the function I need to call but it requires that I have a handle created.

 

I can get a handle to this by using the function CVI_NewApp, but the problem with this is that it opens a new application of CVI (which is definitely not favorable). At a very high level I need this functionality to process over 100 Function Panels so you can see how this can become a bit extensive and involved to open CVI each and every time. This should be a relatively small command-line appilcation that basically takes the file path and passes it to CVI_AppGenHtmlHelpFromFPFile and it does its magic.

 

Any help on this would be greatly appreciated.

 

Thank you

0 Kudos
Message 1 of 8
(5,055 Views)

Good Day GCFalcons,

 

Have you tried using CVI_OpenApp or CVI_ActiveApp instead of creating a new CVI app every time? The help from the CVI_AppGenHtmlHelpFromFPFile suggests these two functions or the CVI_NewApp to get an object handle.

 

Here are a few useful links:

http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/usermanual/actxappgenhtmlhelpfromfpfile/

http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/usermanual/actxappactiveapp/

http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/usermanual/actxappopenapp/

 

ConnorM

0 Kudos
Message 2 of 8
(5,012 Views)

Thanks for your response Connor. Yeah I've looked at CVI_ActiveApp (actually tried running it) and if there isn't an active CVI app open it will open one. Which is pretty much the jist I got from all of the CVI_*App methods. They all seem to have this general statement:

 

"If the server application is already running, this function may or may not start another copy of the application. This is determined by the server application"

 

There's other methods out there that exist like CA_CreateObject from Interface or ProgId but I don't know that information is advertised from the LabWindows/CVI Server (or atleast I'm not to sure on how to acquire that info). 

 

The CVI_OpenApp and CVI_AcitveApp would work if I already had an existing application running, but since I am running it from the command line there is nothing here so it spawns a new application every time.

 

Thank you,

0 Kudos
Message 3 of 8
(4,992 Views)
Solution
Accepted by topic author GCFalcons

Do you need to process each function panel in separate invocations of your program? If so, is there any way that you could process multiple panels per invocation?

 

If you really are stuck running a separate process each time, could you pass some command line flag to your program to tell it whether to shut down CVI or not? If you don't shut it down, then your program could always use CVI_ActiveApp and it would keep reusing the same instance of CVI over and over again. Then, when you call your program for the last function panel in your loop you could pass it a command line flag telling it to shut down CVI before exiting.

Message 4 of 8
(4,984 Views)

Yeah it sucks right now but yes, each function panel will get processed individually therefore calling the program for each invocation. It is part of a build procedure to call them individually (because the list of our function panels can increase or decrease dynamically). Would it be easier to obtain the CLSID for the LabWindows/CVI Server and just create the object from it?

0 Kudos
Message 5 of 8
(4,938 Views)

Obtaining the CLSID from the server and creating the object from it is essentially what happens when you call CVI_ActiveApp.

 

You just have to ensure that an instance of CVI is already running when you want to process a new function panel. Which, to me, means that you wouldn't shut down CVI after you're done processing each function panel.

 

Luis

0 Kudos
Message 6 of 8
(4,932 Views)

I see. I was thinking more along the lines that this call "CA_CreateObjectByClassIdEx" would be what I needed. But in the Notes section it too will open another instance. So I guess it appears that there really is no way around getting a server object handle without opening an instance of CVI. I'll have to rethink how I pass the file paths to this application.

 

Thanks for your help. I'll leave this open for now to see if there are any other thoughts on the matter.

0 Kudos
Message 7 of 8
(4,915 Views)

Wanted to go ahead and close this, following Luis' suggestion to process them all in one invocation of the app. For anyone wondering what I decided to do, was preprocess the list of function panels that needed to generate help files (dynamically), and then pass that information to the program that will actually generate them. Might look into using it in one program to process the list and then generate the files as opposed to having to separate programs that can essentially do the same thing only easier/more efficiently. Thanks again for your help and feedback

0 Kudos
Message 8 of 8
(4,772 Views)