共用方式為


COleDispatchDriver::m_bAutoRelease

Remarks

If TRUE, the COM object accessed by m_lpDispatch will be automatically released when ReleaseDispatch is called or when this COleDispatchDriver object is destroyed.

By default, m_bAutoRelease is set to TRUE in the constructor.

For more information on releasing COM objects, see and in the OLE 2 Programmer’s Reference, Volume 1.

Example

// Clean up by forcing Release to be called
// on COleDispatchDriver object and delete
if (bError)
{
   pDisp.m_bAutoRelease = TRUE;
   delete pDisp;
   pDisp = NULL;
}

COleDispatchDriver OverviewClass MembersHierarchy Chart

See Also   COleDispatchDriver::AttachDispatch, COleDispatchDriver::ReleaseDispatch, COleDispatchDriver::m_lpDispatch