A
Adam Clauss
I am creating a plugin for MS Outlook. Upon clicking a toolbar button, I create series of threads (variable number each time).
Within each thread, I start a form using Application.Run(...). This form contains the Web Browser ActiveX control. Upon creating
the form, I get a ThreadStateException "Could not instantiate ActiveX control ..... because the current thread is not in a
single-threaded apartment."
Right now, I'm using a ThreadPool to actually create the threads (I just queue up each item). I've searched around and it looks
like I need to set the thread apartment state to STA instead of MTA, but I'm not sure how to actually accomplish that here with the
thread pool.
Any suggestions?
Thanks!
Within each thread, I start a form using Application.Run(...). This form contains the Web Browser ActiveX control. Upon creating
the form, I get a ThreadStateException "Could not instantiate ActiveX control ..... because the current thread is not in a
single-threaded apartment."
Right now, I'm using a ThreadPool to actually create the threads (I just queue up each item). I've searched around and it looks
like I need to set the thread apartment state to STA instead of MTA, but I'm not sure how to actually accomplish that here with the
thread pool.
Any suggestions?
Thanks!