private COM_IOleInPlaceFrame _IOleInPlaceFrame;         // cached object for accessing the IOleInPlaceFrame interface

        public Wrapper_IOleInPlaceFrame(IntPtr hostObjectPtr) : base(hostObjectPtr)
        {
            if (hostObjectPtr != IntPtr.Zero)
            {
                _IOleInPlaceFrame = (COM_IOleInPlaceFrame)GetObject();
            }
        }
 public override void Dispose()
 {
     if (_IOleInPlaceFrame != null)
     {
         Marshal.ReleaseComObject(_IOleInPlaceFrame);
         _IOleInPlaceFrame = null;
     }
     base.Dispose();
 }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_IOleInPlaceFrame != null)
                {
                    Marshal.ReleaseComObject(_IOleInPlaceFrame);
                    _IOleInPlaceFrame = null;
                }
            }

            base.Dispose(disposing);
        }