WebBrowser Control & Getting the HTML Source
-
hello again :) I'm trying to use the MS WebBrowser control in a dialog based application I'm making and I'm having the problem that I need to get access to the HTML code so I can work with it inside the program. The interface and most of the supporting stuff is looking good but I can't grast this final problem. It doesn't help that I'm no COM wizard but I'm always willing to learn :) Thanks guys
-
hello again :) I'm trying to use the MS WebBrowser control in a dialog based application I'm making and I'm having the problem that I need to get access to the HTML code so I can work with it inside the program. The interface and most of the supporting stuff is looking good but I can't grast this final problem. It doesn't help that I'm no COM wizard but I'm always willing to learn :) Thanks guys
You've probably dropped the IE ocx onto your dialog. To get the Html from the current web page, you just need to call this method :
HRESULT IWebBrowser2::get_Document(IDispatch** ppDisp);
It returns a IDispatch interface which actually you can cast to IHTMLDocument2. This one is the DOM, ie provides access to the html tags hierarchy.
sometimes it helps to look at the IL generated code a MS guy on develop.com "answering" .NET issues
-
You've probably dropped the IE ocx onto your dialog. To get the Html from the current web page, you just need to call this method :
HRESULT IWebBrowser2::get_Document(IDispatch** ppDisp);
It returns a IDispatch interface which actually you can cast to IHTMLDocument2. This one is the DOM, ie provides access to the html tags hierarchy.
sometimes it helps to look at the IL generated code a MS guy on develop.com "answering" .NET issues
-
hello again :) I'm trying to use the MS WebBrowser control in a dialog based application I'm making and I'm having the problem that I need to get access to the HTML code so I can work with it inside the program. The interface and most of the supporting stuff is looking good but I can't grast this final problem. It doesn't help that I'm no COM wizard but I'm always willing to learn :) Thanks guys
Note a lot of folk have trouble trying to use it, because they don't wait for the DocComplete to fire before altering the page. Try searching the old MSJ for articles by Scott Roberts also, might help. Regardz Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.
-
Note a lot of folk have trouble trying to use it, because they don't wait for the DocComplete to fire before altering the page. Try searching the old MSJ for articles by Scott Roberts also, might help. Regardz Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.