Skip to content

Initialize Method

Called by client applications to initialize the driver and establish an I/O connection to the device.

HRESULT Initialize(BSTR ResourceName, VARIANT_BOOL IdQuery, VARIANT_BOOL Reset, VARIANT_BOOL OptionString);

ResourceName

[in] String identifier specifying how to connect to the device. Usually a VISA resource descriptor.

IdQuery

[in] Indicates whether the driver should perform an ID query check during initialization.

Reset

[in] Specifies whether the driver should execute the Reset function during initialization.

OptionString

[in] Option string specifying various IVI-defined and driver-specific initialization options.

Co<MainClass>.cpp

Returns S_OK if successful, otherwise a failure HRESULT.

The IIviDriver::Initialize method executes in response to each client program call to Initialize. The default implementation simply delegates to an internal Nimbus implementation that performs a wide variety of tasks. It is critical that any customization of the Initialize function ultimately call the internal Nimbus implementation using the following syntax:

hr = DriverBase::Initialize(ResourceName, IdQuery, Reset, OptionString);

The most common reason to customize the implementation of Initialize is to perform pre-processing or post-processing of the Nimbus implementation. Post-processing is arguably more useful since the driver is not in a fully initialized state before the call to the internal Nimbus implementation.