03-18-2014 02:48 PM
I want to create an object in teststand for my C# form dll which has an ActiveX Control . but the error says ActiveX control can not be instantiated because the current thread is not in a single-threaded apartment. can someone help to solve the problem?
Thanks.
03-19-2014 09:07 AM
Two options:
1) put the step in a subsequence and use the sequence call "New thread" option with the advanced setting "Use single-threaded Apartment". Put a wait step immediately after the sequence call to wait for the new thread.
2) Inside of your dll, using .NET APIs create a new thread initialized as STA and call your code from that. Have the original thread wait for the new thread to finish running your dialog code.
Hope this helps,
-Doug
03-19-2014 09:13 AM
Thanks for your help.
For the option(1),
i use the Action not the sequence call, so how can i do that?
03-19-2014 09:39 AM
You could create a new subsequence in your file, place the Action step in that sequence, and then call it from your main sequence with the Sequence Call step as Doug described. This allows you to use the STA option.
03-19-2014 09:57 AM
ok i solved the problem. Thanks a lot!