This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

How Can I Automatically Exit Or Close From My LabVIEW Executable Without Having to Close it?

Updated Apr 19, 2019

Reported In

Software

  • LabVIEW

Issue Details

I have a LabVIEW-built executable and would like to have it close automatically once it is finished running. How can I do this?

Solution

You can use the Quit LabVIEW function which is located in the Functions Palette under Programming>>Application Control.
 
 
 

If the Quit LabVIEW function is called within the development environment, it will close LabVIEW. In order to make this function run only in the executable version of your application, you should enclose it in a Conditional Disable Structure from the Functions Palette under Programming»Structures.

LabVIEW 2009 or later
LabVIEW 2009 added a new conditional symbol that allows the application to determine if it is running inside the development environment or not.
  1. In the Symbols(s) field, choose RUN_TIME_ENGINE.
  2. Leave the center field as ==.
  3. In the Value(s) field, type True.
  4. Select OK.

Move the Quit LabVIEW function to the newly created subdiagram, leaving the Default case empty.

LabVIEW 8.6 or earlier
In LabVIEW 8.6, you must define a custom conditional symbol.
  1. In the Symbol(s) field, type DEPLOY.
  2. Leave the center field as ==.
  3. In the Value(s) field, type TRUE.
  4. Select OK.
  5. Choose Project>>Properties. Note that your VI must be part of a project.
  6. Choose Conditional Disable Symbols in the Category column. Create a new symbol by defining DEPLOY symbol. If you are still developing your application, set the New Value as FALSE. If your application is ready to build, set New Value as TRUE.

Move the Quit LabVIEW function to the newly created sub diagram, leaving the Default case empty.

Before building your executable, ensure that you change the DEPLOY symbol to True in order to enable the Quit LabVIEW function in the deployed application.
 

Additional Information

Be careful when using this VI. Quit LabVIEW functions similarly to the Stop.vi, where a command line call is used to quit LabVIEW. If there are open references, session, or queues, while this is run. They will be terminated, and can cause LabVIEW crashes or Access Violation similar to the one below:
What makes this even more dangerous, is it may quit LabVIEW correctly some of the time, but not all of the time. Consider the following code. It works about half the time depending on the computer:
Best practices of this VI include calling it at the very end of your program, and ensure all data flows and concatenates to a single point, prior to this call, including a wait function prior to this, and closing the Front Panel Programmatically .
 

WAS THIS ARTICLE HELPFUL?

Not Helpful