How to Determine if an Application is Running as a VI or as an Executable

Updated Oct 26, 2023

Environment

Software

  • LabVIEW
  • LabVIEW NXG

How to programmatically determine if an application is running as a VI or an executable.

  • General Purpose OS (e.g. Windows OS)
To programmatically determine the state of your application, use the Application Kind Property Node.
  1. Drop a Property Node from the Application Control palette on the block diagram.
  2. Select the Kind property as in the image below.
  1. The output of the property node will return an enum with the current operating environment. This enum can be used as the selector of a case structure to implement code accordingly.
  • Real-Time Operating System
On the Real-Time Operating System the Application Kind Property Node will always return the value of Embedded LabVIEW, therefore it cannot be used to determine, whether it is a stand-alone RTEXE application.

You may use Conditional Disable Structure instead and check the value of the RUN_TIME_ENGINE symbol. 
  • If RUN_TIME_ENGINE value equals True -  Application was started at boot as stand-alone RTEXE.
  • If RUN_TIME_ENGINE value equals False - Application was deployed from the development computer in the interactive mode. 



Additional Information
On the Real-Time Operating System the Application Kind Property Node will always return the value of Embedded LabVIEW. The reason for this is because the front panel of the program running on the real-time target is not actually on the target, only the block diagram. 

A good use of this property node is when creating applications that need to execute code differently based on the operating environment. An example of this is getting the current file path of an application. If you use the Current VI’s Path function it will return different results if the application is being run as a VI or a built executable. Using this property node you can then handle the difference appropriately.