private void DetachInterfacesInternal() { this.activeXOleObject = null; this.activeXOleInPlaceObject = null; this.activexOleInPlaceActiveObject = null; this.activeXOleControl = null; this.DetachInterfaces(); }
private void AttachInterfacesInternal() { this.activeXOleObject = (UnsafeNativeMethods.IOleObject) this.ActiveXInstance; this.activeXOleInPlaceObject = (UnsafeNativeMethods.IOleInPlaceObject) this.ActiveXInstance; this.activexOleInPlaceActiveObject = (UnsafeNativeMethods.IOleInPlaceActiveObject) this.ActiveXInstance; this.activeXOleControl = (UnsafeNativeMethods.IOleControl) this.ActiveXInstance; this.AttachInterfaces(this.ActiveXInstance); }
private void DetachInterfacesInternal() { this.axOleObject = null; this.axOleInPlaceObject = null; this.axOleInPlaceActiveObject = null; this.axOleControl = null; // // Lets give the inheriting classes a chance to release // their cached interfaces of the ActiveX object. DetachInterfaces(); }
private void AttachInterfacesInternal() { Debug.Assert(activeXInstance != null, "The native control is null"); this.axOleObject = (UnsafeNativeMethods.IOleObject)activeXInstance; this.axOleInPlaceObject = (UnsafeNativeMethods.IOleInPlaceObject)activeXInstance; this.axOleInPlaceActiveObject = (UnsafeNativeMethods.IOleInPlaceActiveObject)activeXInstance; this.axOleControl = (UnsafeNativeMethods.IOleControl)activeXInstance; // // Lets give the inheriting classes a chance to cast // the ActiveX object to the appropriate interfaces. AttachInterfaces(activeXInstance); }
private UnsafeNativeMethods.IOleInPlaceObject GetInPlaceObject() { if (iOleInPlaceObject == null) { Debug.Assert(instance != null, "must have the ocx"); iOleInPlaceObject = (UnsafeNativeMethods.IOleInPlaceObject) instance; #if DEBUG if (iOleInPlaceObject is UnsafeNativeMethods.IOleInPlaceObjectWindowless) Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, GetType().FullName + " Can also be a Windowless control."); #endif //DEBUG } return iOleInPlaceObject; }
private void ReleaseAxControl() { // This line is like a bit of magic... // sometimes, we crash with it on, // sometimes, with it off... // Lately, I have decided to leave it on... // (oh, yes, and the crashes seemed to disappear...) //cpr: ComLib.Release(instance); this.NoComponentChangeEvents++; ContainerControl f = ContainingControl; if (f != null) { f.VisibleChanged -= this.onContainerVisibleChanged; } try { if (instance != null) { Marshal.FinalReleaseComObject(instance); instance = null; iOleInPlaceObject = null; iOleObject = null; iOleControl = null; iOleInPlaceActiveObject = null; iOleInPlaceActiveObjectExternal = null; iPerPropertyBrowsing = null; iCategorizeProperties = null; iPersistStream = null; iPersistStreamInit = null; iPersistStorage = null; } axState[checkedIppb] = false; axState[checkedCP] = false; axState[disposed] = true; freezeCount = 0; axState[sinkAttached] = false; wndprocAddr = IntPtr.Zero; SetOcState(OC_PASSIVE); } finally { this.NoComponentChangeEvents--; } }