Home All Groups Group Topic Archive Search About

MSHTML Without the WebBrowser control

Author
11 Jan 2005 10:25 PM
Joshua Belden
I have an application that runs as a service. It needs to parse a websites
dom using mshtml. The problem is, to get the document I'm trying to use the
WebBrowser control. That barfs though and says that the control can't run
unless the application is setup as STA. I've marked the thread that runs it
as STA, which allows it to run, but the WebBrowser control doesn't actually
navigate.

Is there any other way to load a document into MSHTML without the WebBrowser
Control?

Author
12 Jan 2005 12:48 PM
Dmitriy Lapshin [C# / .NET MVP]
Hi Joshua,

I remember I managed to interop into MSHTML to have it parse HTML, but it
still uses the WebBrowser behind the scenes. The biggest trouble is once an
HTML document to be parsed contains script, this script is executed (leading
either to script error pop-ups, or to message boxes if the script uses the
alert() function).

I'd suggest that you use a third-party parser for your scenario.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Show quote
"Joshua Belden" <JoshuaBel***@discussions.microsoft.com> wrote in message
news:6B813533-2EE7-467D-9CD0-AFE1E3030102@microsoft.com...
>I have an application that runs as a service. It needs to parse a websites
> dom using mshtml. The problem is, to get the document I'm trying to use
> the
> WebBrowser control. That barfs though and says that the control can't run
> unless the application is setup as STA. I've marked the thread that runs
> it
> as STA, which allows it to run, but the WebBrowser control doesn't
> actually
> navigate.
>
> Is there any other way to load a document into MSHTML without the
> WebBrowser
> Control?

AddThis Social Bookmark Button