11-12-2009 08:07 AM
Hi,
Measurement Studio 7.1 - C# .Net 2.0 application.
When trying to create an instance of AxCWGraph in a BackgroundWorker the following error appear:
"ActiveX control 'b68dbfab-16a0-11ce-80bf-0020af31cef9' cannot be instantiated because the current thread is no a single-threaded apartment".
I would like to take snapshots of runtime generated graphs that contain a lot of data. this takes a lot of time and stuck the application. I would like that the main application will continue running normally and the graph snapshots/images will be done in the background.
I would appreciate your help
Thanks in advance'
oren
11-13-2009 03:35 PM
Hi Oren,
The following KnowledgeBase article was written for TestStand however I think the same logic applies:
Why am I Seeing Single-Threaded Apartment Errors When Launching a Module Containing ActiveX Controls in TestStand?
http://digital.ni.com/public.nsf/allkb/3F46208C73E6C92186256E9900758D6A?OpenDocument
The key line may be "because ActiveX does not support multithreading". Unfortunately this means you wont be able to implement the solution with a BackgroundWoker, you may have to look into ways of reducing the amount of data in your graph, so you can get both operations working in the same thread.
Thanks
Scott M.