Using IHTMLDocuments 1, 2, 3, and 4

I am using a web browser in my current project, and currently I am using it in design mode to make it editable, etc. I am currently using the following code:

WebBrowser.Document.DomDocument as IHTMLDocument2

What is IHTMLDocument2, 3, or 4 really? I also found that when determining the current selection range in a document, the range.text.replace method does not work like string.replace does.

Can someone explain to me the main functions of IHTMLDocuments and IHTMLTxtRange, please?

+3
source share
1 answer

IHTMLDocument is an interface that is essentially an โ€œindestructibleโ€ contract that represents what will provide the object that implements it.

, , , .

, :

public interface IMyInterface {
      public int Property1 { get;  set; }
}

Property2, . , :

public interface IMyInterface2 {
    public int Property2 { get;set; }
} 

, IMyInterface:

public class MyObject : IMyInterface, IMyInterface2 {
    public int Property1 { get {} set {} }
    public int Property2 { get {} set {} }
}

, , :

if (obj is IMyInterface) {
   Console.WriteLine(((IMyInterface)obj).Property1);

   if (obj is IMyInterface2) {
      //more
   }
}

, , Microsoft. mshtml, IHTMLDocument, COM-, COM - . , Microsoft , /.

IHTMLTxtRange - TextRange. "" "".

http://www.webreference.com/js/column12/trmethods.html

+2

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


All Articles