Launching an MFC Dialog with ActiveX Controls

Purpose

This example demonstrates how to launch a Microsoft Foundation Classes (MFC) dialog box that contains an ActiveX control when you call the MFC DLL from TestStand.

Example File Location

<TestStand Public>\Examples\Fundamentals\Launching an MFC dialog With ActiveX Controls\Launching an MFC dialog With ActiveX Controls.seq

Highlighted Features

Sequence Call step

Major API

N/A

Prerequisites

None

How to Use This Example

This example shows how to create and properly initialize a thread so it can launch an MFC dialog box that contains ActiveX controls. TestStand must initialize all execution threads for the ActiveX multithreaded concurrency model. MFC requires that any thread that launches a dialog box that contains ActiveX controls must be initialized as apartment-threaded. Therefore, to launch such a dialog box, you must create a temporary worker thread you initialize as apartment-threaded and have the worker launch the dialog box. Meanwhile, the original thread TestStand uses to call the function must wait for the worker thread to exit.

Note When an MFC DLL launches a dialog box that contains an ActiveX control and the DLL does not create a worker thread initialized as apartment-threaded, you can call the DLL function from a TestStand execution thread initialized as apartment-threaded. Use a Sequence Call step to create a new thread and enable the Use Thread Apartment setting in the Sequence Call Advanced Settings dialog box.