InitializeIO Method
Initializes the instrument I/O communication layer (often VISA or VISA-COM).
Syntax
Section titled “Syntax”virtual HRESULT InitializeIO();Co<MainClass>.cpp
Return value
Section titled “Return value”Returns S_OK if successful, otherwise a failure HRESULT.
When to Override
Section titled “When to Override”Override this function when you want to do additional initialization at the same time as when the I/O is initialized. A common case is if you want to implement your driver by delegating to an external DLL for the I/O. You would want to initialize the external DLL here.
Remarks
Section titled “Remarks”This function is used in the Nimbus implementation of the IIviDriver::Initialize method.
An alternative is to put the additional initialization code in OnFinalInitialize. One important difference is that InitializeIO is called before GetDynamicRepCapNames, but OnFinalInitialize is called after it. Thus, if the dynamic repeated capability discovery code requires custom I/O initialization, that initialization has to be done in InitializeIO.
Example
Section titled “Example”class ATL_NO_VTABLE Acme4321 :{ // ...
virtual HRESULT InitializeIO() { // Call the base class implementation HRESULT hr = __super::InitializeIO(); if (SUCCEEDED(hr)) { CString strResourceDesc = GetResourceDescriptor();
// TODO: additional I/O initialization here, such as initializing an external DLL }
return hr; }
// ...}