How to correctly instaniate active x a controls

Mondeo

Centurion
Joined
Nov 10, 2006
Messages
128
Location
Sunny Lancashire
Does anyone know how to instantiate/initialize an active x control in a windows forms app in code. In particular the ax web browser control.

It works fine just dropping it onto the form, but I want to create it from scratch in a seperate thread to the UI, I can create it and it appears on the form however when I call its navigate method I get this

Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was unhandled

Thanks
 
Bottom line is you shouldn't mess with the UI from any thread other than the UI thread itself. Adding COM threading issues into the problem (like the IE control) is pretty much doomed from the start.
 
Is there a better option?

I thought earlier about having 7 web services which all create an indidivual instance of the browser, perform the manipulation and then return the result.

Then in my forms app I could simply call the individual web services on different threads.

Would that work okay do you think?

Thanks
 
Back
Top