コード例 #1
0
        public Wrapper_IOleInPlaceFrame _cachedFrame; // cache the frame object returned from GetWindowContext, so that we can control the tear down

        public Wrapper_IOleClientSite(IntPtr hostObjectPtr) : base(hostObjectPtr)
        {
            if (hostObjectPtr != IntPtr.Zero)
            {
                _IOleClientSite  = (COM_IOleClientSite)GetObject();
                _IOleInPlaceSite = (COM_IOleInPlaceSite)GetObject();
            }
        }
コード例 #2
0
        public override void Dispose()
        {
            _cachedFrame?.Dispose();
            _cachedFrame = null;

            if (_IOleClientSite != null)
            {
                Marshal.ReleaseComObject(_IOleClientSite);
                _IOleClientSite = null;
            }

            if (_IOleInPlaceSite != null)
            {
                Marshal.ReleaseComObject(_IOleInPlaceSite);
                _IOleInPlaceSite = null;
            }

            base.Dispose();
        }
コード例 #3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _cachedFrame?.Dispose();
                _cachedFrame = null;

                if (_IOleClientSite != null)
                {
                    Marshal.ReleaseComObject(_IOleClientSite);
                    _IOleClientSite = null;
                }

                if (_IOleInPlaceSite != null)
                {
                    Marshal.ReleaseComObject(_IOleInPlaceSite);
                    _IOleInPlaceSite = null;
                }
            }

            base.Dispose(disposing);
        }