Single-threaded apartment - cannot instantiate ActiveX control

Posted by martin.malek on Stack Overflow See other posts from Stack Overflow or by martin.malek
Published on 2009-09-13T18:21:50Z Indexed on 2010/06/02 22:34 UTC
Read the original article Hit count: 606

Filed under:
|
|
|

I need to get information about applied CSS styles in HTML page. I used AxWebBrowser and iterate IHTMLDOMNode. I'm able to get all the data I need and move the code into my application. The problem is that this part is running inside of the background worker and I got exception when trying to instantiate the control.

AxWebBrowser browser = new AxWebBrowser();

ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated
because the current thread is not in a single-threaded apartment.

Is there any way how to solve this or other option than AxWebBrowser?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about exception