What object does the WPF WebBrowser.Document property return?

From MSDN, the return type is simply an “object”.

But this returned object can be changed in mshtml.HTMLDocument if you want to manipulate the elements, or the same object can be changed (mshtml.HTMLDocumentEvents2_Event) if you want to register a callback.

There are so many interfaces in MSHTML link . But it is unclear how to use these interfaces with the WPF WebBrowser.Document object

If the returned object is a COM object, then What is it? What is the difference between this WPF WebBrowser.Document and the form of the WebBrower window . Document ?

Code example:

mshtml.HTMLDocument doc = (mshtml.HTMLDocument)_browser.Document;
IHTMLElement bt = doc.getElementById("123");

mshtml.HTMLDocumentEvents2_Event iEvent = (mshtml.HTMLDocumentEvents2_Event)_browser.Document;
iEvent.onclick += new HTMLDocumentEvents2_onclickEventHandler(ClickEventHandler);
+4
1

Windows Forms

WPF

+1

Source: https://habr.com/ru/post/1570396/


All Articles