IResourceManager::Open

Description

This is the method for creating a VISA COM I/O resource.  The ResourceName parameter is the VISA resource name to be created, such as GPIB0::11::INSTR or ASRL0::INSTR.  The AccessMode parameter sets the type of lock to attain on open.  The timeout parameter refers to the time to wait to attain a lock on the instrument, not the I/O timeout.  The OptionString parameter allows the user to set properties of the resource on creation.  The return value is a pointer to the IVisaSession interface on the newly created object. See VISA Resource Strings for more information on the format of the address string parameter and The Option String for more information on the format of the option string.

VB Prototype

value As IVisaSession = Open(
  ResourceName As String,
  mode As AccessMode, ' Optional Parameter
  openTimeout As Long, ' Optional Parameter
  OptionString As String ' Optional Parameter
)

C++ Prototype

HRESULT Open(
  BSTR ResourceName,
  AccessMode mode,
  long openTimeout,
  BSTR OptionString,
  IVisaSession** vi
);

Parameters

ResourceName

The resource name string.  See VISA Resource Strings for more information on the format of the ResourceName parameter.

mode

[Optional in Visual Basic] The lock type to attempt. The openTimeout property will be used to wait a maximum amount of time to retrieve the lock.

openTimeout

[Optional in Visual Basic] The lock timeout in milliseconds. This is different from the I/O Timeout property of the session. The lock timeout only affects how long the Open call will wait to get a lock on the I/O session if the mode parameter of Open indicates locking should be attempted.

OptionString

[Optional in Visual Basic] The option string to apply to the resource.  See The Option String for more information on the format of the option string parameter.

vi

The new resource session.

Return Value

Refer to the table of return codes.

See Also

SoftwareManufacturerName, SoftwareManufacturerID, Description, ComponentVersion, ProgID, SpecVersion, FindRsrc, Open, ParseRsrc, IResourceManager Overview