How do can man use ActiveX controls from .NET WinForms app so that reference to the IDispatch-implementing object retrieved from ActiveX control wrapper wouldn't be necessarily marshalled to the main thread and ActiveX code not invoked from STA thread's context? A kind of , I would presume, a trivial question that is, only that I couldn't get an answer anywhere.
I'll explain: if one adds the ActiveX on a form, retrieves a pointer to some automation object, and tries to call that pointer from other thread's context (not from main form, for example), .NET interop marshalls the pointer to the main form (by putting a windows message to the form's message queue and processing call at the main form, (in a BackgroundWorker fashion?)), so that all calls to ActiveX methods are made from the same thread. I would like to avoid this, because ActiveX component is thread-safe and, actually, such behaviour is not acceptable since ActiveX method may block, and it is invoked from a server application (that is, ActiveX method implementation must be called asynchronously, not one by one). If ActiveX is registered as MTA @ registry then VS designer throws an exception when dragging ActiveX on a form. Any solutions in case this marshalling cannot be 'disabled'? Thanks! If I add ActiveX control on a form (WinForm application), get a reference to some =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
