![]() | InitializeIO Method |
Initializes the instrument I/O communication layer (often VISA or VISA-COM).
virtual HRESULT InitializeIO();
Co<MainClass>.cpp
Returns S_OK if successful, otherwise a failure HRESULT.
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.
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.
// CoAcme4321.h 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; } // ... }