LabVIEW creates an application instance for each target in a LabVIEW project. When you open a VI from the Project Explorer window, the VI opens in the application instance for the target. LabVIEW also creates a main application instance, which contains open VIs that are not part of a project and VIs that you did not open from a project. Additionally, LabVIEW loads shared libraries in a unique application instance. Opening a shared library in a unique application instance prevents naming conflicts with VIs in the shared library, and VIs outside of the shared library.
Use the application instance name that appears in the application instance shortcut menu on the bottom left corner of the front panel and block diagram windows to identify which application instance a VI belongs to.
If you remove a VI from the Project Explorer window when the VI is open, the open VI remains in the same application instance. You can select an application instance for a VI by using the application instance shortcut menu in the bottom left corner of the front panel and block diagram windows.
If you add an open VI to a project by selecting the VI icon in the upper right corner of a front panel or block diagram window and dragging the icon to a target in the Project Explorer window, or if you drag an item from one target to another in the Project Explorer window, the open VI is not part of the application instance for the target until you select an application instance.
You also can use the Application:Default:Application property to return the default application reference programmatically. Use the Application property to open the target application instance programmatically.
You can open the same VI on disk in multiple application instances at the same time. For example, you can open the same VI in two different projects or from two different targets within a project.
If you edit a VI that is open in only one application instance and then open the VI in another application instance, the VI you just opened contains the latest changes from the edited instance of the VI. However, if you edit a VI that is already open in more than one application instance, LabVIEW does not automatically apply the changes to the VI in the other application instances. You cannot edit, run, or save the VI in the other application instances until the VI is the same in all application instances.
Use one of the following methods to make the VI the same in all application instances.
|Note You cannot undo edits to the VI after you synchronize the VI.|
You must use an application reference when you are using VI server properties and methods in one application instance, and you want to interact with a different application instance. It may not be obvious that VIs are running in multiple application instances. For example, each LabVIEW project has its own application instance. VIs running in project1.lvproj are running in a different application instance than VIs running in project2.lvproj. VIs not running in a project run in the main application instance. In addition, LabVIEW opens user VIs you place in the labview\help, labview\project, and labview\wizard directories in a private application instance. For example, if you place a VI in the labview\project directory and then launch this VI from the Tools menu, LabVIEW runs the VI in a private application instance (NI.LV.Dialog) that is separate from the main application instance.
You cannot edit a VI while it is running or reserved for execution in another application instance. If a VI is part of a project library, LabVIEW also temporarily locks the project library in all application instances when the VI runs. You cannot edit the project library while the VI is running. After the VI stops, LabVIEW unlocks the project library.