GetVIReference Method

Requires: Base Development System

Class: Application Methods (ActiveX)

Places a VI in memory and returns the IDispatch pointer for the VI.

Syntax

object.GetVIReference(viPath, [password], [resvForCall], [options])

Parameters

NameTypeDescription
viPathStringAbsolute path to the VI placed in memory.
passwordStringIf the VI is password-protected, you must enter the password to make any edits.
resvForCallBooleanIf TRUE, the VI is set to an execution state called reserved. You cannot edit a reserved VI because the VI can be called as a subVI at any time while its parent VI runs. Setting the VI to reserved at the time of the reference speeds up calls to the VI. However, this state does not support any of the edit mode properties or methods. To bring the VI out of the reserved execution state, close this reference and open a new reference by setting resvForCall to FALSE.

If you are working with a reentrant VI, it is important to set this parameter to TRUE so that LabVIEW can call the VI efficiently.
optionsunsigned longA bit set that specifies how the VI reference is treated. options can be a combination of the following values. The default is 0x10.
0x01Record modifications. An asterisk (*) appears by the VI title to indicate that changes have been made using VI Server. The VI must be in edit mode for LabVIEW to record the modifications.
0x02Open templates for editing. This option opens the original .vit file. If you do not select this option, LabVIEW opens a new instance of the template VI. Edits made to an instance do not affect the original .vit file. This option has no effect on non-template files.
0x04Prompt user to save changes when this VI reference closes if all the following conditions are true:
  • The referenced VI or its subVIs contain unsaved changes.
  • There are no other open references to the referenced VI.
  • The referenced VI is able to leave memory. A VI is able to leave memory, for example, if no other VIs call the VI, the front panel of the VI is closed, and the VI is not a member of an open project library, and so on.
0x08Prepare for reentrant run. Reserves the target VI so it cannot be edited and if the target VI is reentrant, allocates a dedicated parallel data space for this VI reference. If the target VI is not reentrant, this method returns an error. When you release the VI reference, LabVIEW unreserves the reentrant target VI and deallocates a parallel data space. Use this option with the Run method to run multiple instances of a reentrant VI simultaneously. If you target a reentrant VI and do not use this option, this method returns a reference to the VI without allocating a parallel data space for the VI reference. When you do not use this option, multiple calls to this method for a reentrant VI return references to the same VI with the same data space, and this method does not clone the VI.
0x10Prompt user to find missing subVIs of the referenced VI.
0x20Do not display the loading dialog box when searching for missing subVIs of the referenced VI.
Note  This option does not affect whether LabVIEW prompts you to find the missing VIs or not.

Return Value

VirtualInstrument *