LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I perform an Open VI Ref for a VI in my EXE?

Good evening,
 
I'm building a LV8.5 VI into an EXE using application builder.  I am trying to get a reference to a SubVI using Open VI Reference.  When I wire the subvi name as a string, I get an Error 1004 failure and the dialog says "the VI is not in memory".
 
I also tried the Open VI Reference by wiring a path that includes the EXE name prepended  C:\MyApp\MyEXE.exe\MyVI.vi
When I tried this I got an Error 7 for File not Found
 
Does anyone know the proper way to include a SubVI in an EXE to be accessed later with Open VI Reference?  I'm not certain if my VI that I'm loading dynamically was actually included in my EXE or if I'm providing the correct location for Open VI Reference.
 
Any advice or examples is appreciated.  I'm using LV8.5 with the application builder.
 
Thanks,
Chris Norris
Embla Systems, Inc.
 
 
0 Kudos
Message 1 of 8
(5,336 Views)

Hey,

Did you reference your VI as supporting File (since 8.5 "always include") in the build specifications?

Attached you will find a little example project using the "Call by Reference Node" to dynamically call aVI.

Christian

Message 2 of 8
(5,332 Views)

This definately sounds like you have not placed your vi into your executable. When you dynamically call a vi, it is not included automatically into the exe. You have to add it as a support file. There is a window in the exe builder where at the top left you select your "top level vi" then below that your "support vis" Make sure that the vi you are trying to call is included in the support vi list.

If you are always calling the same vi, even multiple times, there is a way to get the path without as much bother. Create a static reference to your vi. It is a little icon into which you place your vi on the diagram. Pull the reference from this, then use the properties vi to get the path. Open your vi reference using this path. Do not use the static reference to do things to the vi, as this can cause problems for you, especially if close the calling vi.

 

Good luck,

CyberTazer
Software Systems Engineer
Message 3 of 8
(5,317 Views)
Thanks for the assistance guys.  I agree with the assessment that my EXE was missing VI's that are loaded at run time.
 
When I modified my build spec to include the missing VI, I got an error when I tried to build the EXE (it complained about a bad VI).
 
Then I tried including the static reference in my top-level VI instead, and this worked!
 
I may troubleshoot the build spec later, but for now I'm going with the static reference since it made my EXE happy with minimum fuss.
 
Cheers!
 
Chris Norris
Firmware Engineer
Embla Systems, Inc.
 
 
0 Kudos
Message 4 of 8
(5,264 Views)
Good tip cybertazer, that is not something I had thought of.

I wonder why you got less than five stars? Probably from someone who is not aware of the negative connatations of a less than five star rating.
0 Kudos
Message 5 of 8
(5,249 Views)

Thanks guys... As we all know, there is quite alot that goes on under the hood of labview programs. Compound that with code organization and the changing things around by the developer, and it can get annoying trying to keep up with all the paths in a program. One of the projects I work on has a couple thousand vi's in it and many dynamic calls. If you reference a vi from more than one place, it gets even more interesting because you have to find all the places to make a change. This way, when you change the vi, or where it is at, labview at least makes an attempt to correct the problem without intervention of the developer. You may still have to go in and tweak, but it saves you from going through every dynamic call for every little change.

 

Glad I could help.

 

CyberTazer
Software Systems Engineer
0 Kudos
Message 6 of 8
(5,221 Views)

I have a similar but slightly different problem.  I want to have a separate LV VI call a VI in an existing LV executable without having to modify the executable (it has been released).  I found an example in the devzone that does just that.  Controlling Two Executables with the VI Server http://zone.ni.com/devzone/cda/epd/p/id/1366 

 

Very cool and it even works.  The problem is that it was built in LV 7 and I'm using 8.6.  When I try to do something similar in 8.6, I get the aforementioned  Error 7 File not found when I try to point to the slave.vi within slave.exe.

 

Seems like the way LV deals with VIs inside exes has changed.

 

Is there a new way to accomplish my goal of calling a VI within an existing exe?

 

Thanks,

Hans 

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

Hi hans17,

 

As of LabVIEW 8.2, this is no longer allowed. Please check out this KB for more information: Accessing VIs Inside of a LabVIEW Executable or DLL in LabVIEW 8.2 and Later

Jeff | LabVIEW Software Engineer
0 Kudos
Message 8 of 8
(4,928 Views)