Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 4 out of 5     Rate this Document

New Sequence Adapter COM Multithreading Setting in TestStand 3.0

Primary Software: TestStand
Primary Software Version: 3.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
In TestStand 2.0.x and earlier I had to create a wrapper .dll to call my code that displayed a dialog with ActiveX controls on it. Do I still have to do this in TestStand 3.0?

Solution:
In TestStand 3.0 there is a new setting under the Multithreading and Remote Execution settings of Sequence Call steps (or any other step that uses the Sequence Adapter) that allows you to specify that if a new thread or execution is to be launched for a subsequence it should be initialized in Single-Threaded Apartment mode. You should use this setting if the subsequence to be called with the Sequence Adapter step calls any other steps internally that will display dialogs/windows containing ActiveX controls on them. To access this setting do the following:
  1. Insert a Sequence Call step or any other steptype using the Sequence Adapter

  2. Right-click the step and select Specify Module

  3. In the Multithreading and Remote Execution section select either Run Sequence in a New Thread or Run Sequence in a New Execution

  4. Click the Settings... button

  5. Check the box labeled Use Single-Threaded Apartment to enable this mode

There is a known issue in TestStand 2.0.x involving calling code modules that display dialogs/windows containing ActiveX controls directly from a TestStand sequence execution. When this is done the thread would experience abnormal behavior, such as hanging or becoming non-responsive. This was caused by the fact that TestStand sequence execution threads are created with Multi-Threaded Apartment mode by default, which is incompatible with dialogs containing ActiveX controls (they require Single-Threaded Apartment mode), and with TestStand 2.0.x and earlier there was no way to change this behavior from within TestStand. The new setting in 3.0 described above gives you the capability of changing this thread attribute directly in TestStand. For TestStand 2.0.x and earlier users to handle this issue refer to the Developer Zone Example and KnowledgeBase documents listed in the Related Links section.

Related Links:
KnowledgeBase 39IE8AMT: Executing a Code Module Called by TestStand in an STA Thread
KnowledgeBase 2JIC15IJ: DLL Works When Called outside of TestStand but Not When Called from TestStand
Developer Zone Example: Displaying a Dialog With ActiveX Controls On It From a DLL Called by TestStand

Attachments:





Report Date: 08/15/2003
Last Updated: 12/13/2007
Document ID: 30E9LEEV

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit