Skip to content

OnFinalConstruct Method

Called during instantiation of a driver.

virtual HRESULT OnFinalConstruct();

Co<MainClass>.cpp

Returns S_OK if successful, otherwise a failure HRESULT.

The OnFinalConstruct method can be used to perform any driver-specific initialization just after object construction. The OnFinalConstruct method executes only once on the main driver class over the lifetime of the driver, irrespective of the number of times a client application calls IIviDriver::Initialize and IIviDriver::Close.

Since OnFinalConstruct executes before IIviDriver::Initialize, this function can be used to initialize data for driver methods that can themselves execute before the client calls IIviDriver::Initialize. In practice, this situation is quite rare, since most driver methods require Initialize to be called. For this reason, OnFinalConstruct is not often used in IVI-COM drivers. Rather, the ResetObjectState method, which is called with each invocation of Initialize, is used. See the description of ResetObjectState for more information.