Пример #1
0
        public int /* IOleObject:: */ SetClientSite([In] IntPtr /* IOleClientSite */ pClientSite)
        {
            _logger.Log(LogLevel.Trace, "IOleObject::SetClientSite() called");

            // IOleObject::SetClientSite is typically called with pClientSite = null just before calling IOleObject::Close()
            // We release all host COM objects here in that instance.

            _cachedClientSite?.Dispose();
            _cachedClientSite = null;

            if (pClientSite != IntPtr.Zero)
            {
                _cachedClientSite = new Wrapper_IOleClientSite(pClientSite);
                return(_userControl.IOleObject.SetClientSite(_cachedClientSite.PeekAggregatedReference()));     // callee will take its own reference
            }
            return((int)ComConstants.S_OK);
        }
Пример #2
0
 private void ReleaseActiveXControlComReference()
 {
     _logger.Log(LogLevel.Trace, "IOleObject::Close() ... closing down host COM references");
     _cachedClientSite?.Dispose();
     _cachedClientSite = null;
 }