Showing results for 
Search instead for 
Did you mean: 

Create an Exe of a VI that controls another VI

I have a VI that opens and controls another VI. How do I build a executable of the entire application. When I create the exe. I get an error that a reference cannot be found. I have attached an example of how I have build my VI's.
Download All
0 Kudos
Message 1 of 3
include the controlled VI as "Dynamic VI" when you build the application. Dynamic VIs are included in the internal LLB of the executable and can be opened by the Top Level VI. I see that you open the FP of the VI then you need to change the settings of the VI to save the front panel in the VI. By default the FP of dynamic VI is not saved; this causes run-time errors when attempting to open FP.
If you do not want to include the VI in the application file you must provide code to compute the path to the called VI instead of stripping the caller VI path, which points to a VI inside the executable.

LabVIEW, C'est LabVIEW

Message 2 of 3

There are two issues here.

First of all, when you use "Get this VIs Path" in development, you get a different answer than you do in runtime. This is because the VI no longer has a path.

Secondly, when you build the application, VIs called by VI server do not become a part of the application. They remain as VIs, but are included, if you choose, in a directory that you specify, or are not included at all.

My company uses a utility (that I created) that solves this issue. However; you have to be careful about implementation. The utility is quite simple: It stores the location of the function itself when it is a VI, and the location of the dll when it is deployed. You can very easily change this function to search for an exe.

As this
code belongs to my company, I cannot post it. However, I can help you create one if you like. Again, it is quite simple.

Here are the instructions for you to create your own. I have written it in pseudocode.

"Get This VIs Path"
Strip Path
Convert Path to String
Search String for "[.]exe" or "[.]dll" if it is a dll
if Offset Past Match of Search String <=0, output stripped path
else, strip path again and output

You have to remember that for development, you have to place the 'slave' VI in the same directory as the utility that gets the path. This is VERY important: YOU MUST BUILD A VI THAT GETS THE PATH. In otherwords, the code above must be a seperate VI, that you drop in to replace "Get This VIs Path". You then have to remember that the path is the same as the location of the utility that you built. When you build the application, the slave VI has to be in the same directory as the .exe for this to work properly.

The ONLY other way around this is to hard code
the file path.

I hope this helps
Message 3 of 3