public int ActivateMe(Interop.IOleDocumentView pViewToActivate) { if (pViewToActivate == null) { return(Interop.E_INVALIDARG); } Interop.RECT r = EditorRect; interopDocumentView = pViewToActivate; interopDocumentView.SetInPlaceSite(this); interopDocumentView.UIActivate(WithUI ? 1 : 0); interopDocumentView.SetRect(r); interopDocumentView.Show(1); return(Interop.S_OK); }
/////////////////////////////////////////////////////////////////////////// // Interop.IOleDocumentSite Implementation public int ActivateMe(Interop.IOleDocumentView pViewToActivate) { Debug.Assert(pViewToActivate != null, "Expected the view to be non-null"); if (pViewToActivate == null) { return(Interop.E_INVALIDARG); } Interop.COMRECT r = new Interop.COMRECT(); Interop.GetClientRect(hostControl.Handle, r); tridentView = pViewToActivate; tridentView.SetInPlaceSite((Interop.IOleInPlaceSite) this); tridentView.UIActivate(1); tridentView.SetRect(r); tridentView.Show(1); return(Interop.S_OK); }
/// <summary> /// </summary> public void Dispose() { try { int RefCount; if (propNotifyCookie != null) { propNotifyCookie.Dispose(); propNotifyCookie = null; } if (winEvents != null) { winEvents.Dispose(); winEvents = null; } try { Marshal.ReleaseComObject(window); } catch { } try { if (interopDocumentView != null) { try { interopDocumentView.Show(0); } catch { } try { interopDocumentView.UIActivate(0); } catch { } try { interopDocumentView.SetInPlaceSite(null); } catch { } long nullParam = 0L; try { interopDocumentView.Close(nullParam); do { RefCount = Marshal.ReleaseComObject(interopDocumentView); } while (RefCount >= 0); } catch { } finally { Marshal.FinalReleaseComObject(interopDocumentView); interopDocumentView = null; } } } catch { } if (oleDocumentObject != null) { try { if (htmlEditor.Site == null || !htmlEditor.Site.DesignMode) { Marshal.FinalReleaseComObject(oleDocumentObject); oleDocumentObject = null; } } catch { } } if (htmlbaseDocument != null) { do { RefCount = Marshal.ReleaseComObject(htmlbaseDocument); } while (RefCount >= 0); Marshal.FinalReleaseComObject(htmlbaseDocument); htmlbaseDocument = null; } if (interopDocumentView != null) { do { RefCount = Marshal.ReleaseComObject(interopDocumentView); } while (RefCount >= 0); } if (activeObject != null) { do { RefCount = Marshal.ReleaseComObject(activeObject); } while (RefCount >= 0); Marshal.FinalReleaseComObject(activeObject); activeObject = null; } interopDocumentView = null; htmlbaseDocument = null; activeObject = null; } catch (Exception ex) { Debug.WriteLine(ex.Message); } }