Building VI Server Applications

The programming model for VI Server applications is based on refnums. Refnums also are used in file I/O, network connections, and other objects in LabVIEW.

Typically, you open a refnum to an application instance or to a VI. You then use the refnum as a parameter to other VIs. The VIs get (read) or set (write) properties, execute methods, or dynamically load and call a referenced VI. Finally, you close the refnum, which releases the referenced VI from memory.

Use the following Application Control functions and nodes to build VI Server applications:

Application and VI References

You access VI Server functionality through references to two main classes of objects�the Application object and the VI object. After you create a reference to one of these objects, you can pass the reference to a VI or function that performs an operation on the object.

An Application reference refers to a local or remote application instance. You can use Application properties and methods to change LabVIEW preferences and return system information. A VI refnum refers to a VI in an application instance.

With a reference to an application instance, you can retrieve information about the LabVIEW environment, such as the platform on which LabVIEW is running, the version number, or a list of all VIs currently in memory. You also can set information, such as the list of VIs exported to other application instances. Because you can open multiple application instances at once, 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. For example, LabVIEW opens a new application instance when you create a LabVIEW project or a target for a LabVIEW project.

When you create a refnum to a VI, LabVIEW loads the VI into memory. The VI stays in memory until you close the reference and until the VI meets the following conditions:

With a refnum to a VI, you can update all the properties of the VI available in the VI Properties dialog box as well as dynamic properties, such as the position of the owning pane. You also can programmatically print the VI documentation, save the VI to another location, and export and import its strings to translate into another language.