private void ExecuteCommand(object state) { int commandId = Convert.ToInt32(state); Interop.IOleCommandTarget CommandTarget = (Interop.IOleCommandTarget)baseDocument; CommandTarget.Exec(ref Interop.Guid_MSHTML, commandId, (int)Interop.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, arg, nil); }
/// <summary> /// </summary> public void CloseMSHTML() { hostControl.Resize -= new EventHandler(this.OnParentResize); try { if (propNotifyCookie != null) { propNotifyCookie.Disconnect(); propNotifyCookie = null; } if (tridentDocument != null) { tridentView = null; tridentDocument = null; tridentCmdTarget = null; activeObject = null; if (adviseSinkCookie != 0) { tridentOleObject.Unadvise(adviseSinkCookie); adviseSinkCookie = 0; } tridentOleObject.Close(Interop.OLECLOSE_NOSAVE); tridentOleObject.SetClientSite(null); tridentOleObject = null; } } catch (Exception e) { Debug.Fail(e.ToString()); } }
/// <summary> /// </summary> public void CreateMSHTML() { Debug.Assert(tridentDocument == null, "Must call CloseMSHTML before recreating."); bool created = false; try { // create the trident instance tridentDocument = (Interop.IHTMLDocument2) new Interop.HTMLDocument(); tridentOleObject = (Interop.IOleObject)tridentDocument; // hand it our Interop.IOleClientSite implementation tridentOleObject.SetClientSite((Interop.IOleClientSite) this); created = true; propNotifyCookie = new Interop.ConnectionPointCookie(tridentDocument, this, typeof(Interop.IPropertyNotifySink), false); tridentOleObject.Advise((Interop.IAdviseSink) this, out adviseSinkCookie); Debug.Assert(adviseSinkCookie != 0); tridentCmdTarget = (Interop.IOleCommandTarget)tridentDocument; } finally { if (created == false) { tridentDocument = null; tridentOleObject = null; tridentCmdTarget = null; } } }
internal FrameWindow(Interop.IHTMLWindow2 window, MSHTMLSite relatedSite, HtmlEditor htmlEditor) { this._relatedSite = relatedSite; this.window = window; this.doc = (Interop.IHTMLDocument2)window.document; this.url = ((Interop.IHTMLLocation)((Interop.IHTMLWindow2)doc.GetParentWindow()).location).href; this.body = (Interop.IHTMLElement3)doc.GetBody(); this.framebase = ((Interop.IHTMLWindow4)window).frameElement; this.htmlFormatter = new HtmlFormatter(); this.CommandTarget = (Interop.IOleCommandTarget)doc; this.winEvents = new FrameEvents(window, htmlEditor); this.winEvents.Activate += new EventHandler(winEvents_Activate); this.winEvents.DeActivate += new EventHandler(winEvents_DeActivate); this.nativeElement = (FrameElement)htmlEditor.GenericElementFactory.CreateElement(framebase as Interop.IHTMLElement); }
public void CloseMSHTML() { this.hostControl.Resize -= new EventHandler(this.OnParentResize); try { if (this.propNotifyCookie != null) { this.propNotifyCookie.Disconnect(); this.propNotifyCookie = null; } if (this.tridentDocument != null) { this.tridentView = null; this.tridentDocument = null; this.tridentCmdTarget = null; this.activeObject = null; if (this.adviseSinkCookie != 0) { this.tridentOleObject.Unadvise(this.adviseSinkCookie); this.adviseSinkCookie = 0; } this.tridentOleObject.Close(1); this.tridentOleObject.SetClientSite(null); this.tridentOleObject = null; } } catch (Exception) { } }
public void CreateMSHTML() { bool flag = false; try { this.tridentDocument = (Interop.IHTMLDocument2) new Interop.HTMLDocument(); this.tridentOleObject = (Interop.IOleObject) this.tridentDocument; this.tridentOleObject.SetClientSite(this); flag = true; this.propNotifyCookie = new Interop.ConnectionPointCookie(this.tridentDocument, this, typeof(Interop.IPropertyNotifySink), false); this.tridentOleObject.Advise(this, out this.adviseSinkCookie); this.tridentCmdTarget = (Interop.IOleCommandTarget) this.tridentDocument; } finally { if (!flag) { this.tridentDocument = null; this.tridentOleObject = null; this.tridentCmdTarget = null; } } }
public int ShowUI(int dwID, Interop.IOleInPlaceActiveObject activeObject, Interop.IOleCommandTarget commandTarget, Interop.IOleInPlaceFrame frame, Interop.IOleInPlaceUIWindow doc) { return(Interop.S_OK); }