From: Peter Duniho on
sheperson(a)googlemail.com wrote:
> Hi,
> I am trying to use a Web Browser control in my program. My program is
> not a single thread, and I really need to use threading. When I create
> a Web Browser object in the child thread, I get this error:
> ---
> ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be
> instantiated because the current thread is not in a single-threaded
> apartment.
> ---
> I know this is because of the threading issue.
>
> Is there a work around to this problem? Any ideas, solutions?
> Thanks in advance.

The error tells you exactly what the problem is.

Create the control in a thread that _is_ a single-threaded apartment thread.

If you're trying to use the web browser control, then you ought to have
an STA thread already. Use that thread to create and use the control.

If you don't have an STA thread already, then you have a lot more work
to do before you can host the web browser control.

Pete