5

I want to learn some basics about MSHTML, like how to use IHtmlDocument and IHtmlDocument2 interfaces. I searched for quite a while, but can not find out a tutorial for beginners. Could anyone recommend something to read?

EDIT: I prefer to use C#.

pnuts
  • 58,317
  • 11
  • 87
  • 139
George2
  • 44,761
  • 110
  • 317
  • 455

3 Answers3

5

When I was learning to use MSHTML I mostly relied on the MSDN documentation and asked specific details in newsgroups and sites like this.

It also helped me alot to download the whole Windows SDK instead of reading online.

Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
  • Thanks DR, I have read the documents you listed here before. They are more about API document, but what I need is a tutorial or something for a beginner to learn how to use MSHTML to develop some simple applications step-by-step. – George2 Mar 21 '09 at 13:12
4

If you are using C#, then you should not be using MSHTML. Use the WebBrowser component if you're using Windows Forms, use any of the XML APIs if you're trying to generate HTML (as XHTML). You might possibly want to use an HtmlWriter, but stay away from unmanaged code, if you can help it.


Links:

BTW, MSHTML is not a new thing - it's an old thing. BTW2, is this the George2?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Thanks John, not get too much impression about what do you mean "WebBrowser component" and "HtmlWriter", could you refer to some links about your ideas please? – George2 Mar 21 '09 at 14:11
  • @John, appreciated if you could recommend me to some basic tutorials about how to use MSHTML in unmanaged code. I am very interested to learn new things. :-) – George2 Mar 21 '09 at 14:11
  • George, if you intend to scrape HTML and crawl the DOM then you will want MSHTML. – Neil Kimber Oct 24 '09 at 17:35
  • @Neil: why would he use MSHTML and not the WebBrowser control? – John Saunders Oct 26 '09 at 00:55
  • The WPF and Windows Forms WebBrowser controls both use MSHTML. Using these classes and interop to access the various interfaces is the logical thing to do. You'll find most of the required MSHTML and COM type declarations on pinvoke.net and koders.com. MSDN has documentation on all interfaces. – Ludvig A. Norin Jan 17 '11 at 16:23
  • @Ludvig: you might be surprised how many people don't know COM these days. – John Saunders Jan 18 '11 at 19:32
0

There are some tutorials under the "hosting and reuse" section of IE SDK documentation. But I guess you need to read the DHTML tutorials under the HTML/CSS section as well.

Sheng Jiang 蒋晟
  • 15,125
  • 2
  • 28
  • 46