Exit TestStand UI From Inside Modelsupport2.dll

Updated May 3, 2018

Reported In

Software

  • TestStand

Issue Details

I want to leave the TestStand User Interface and sequence that is executing with a single button click from my test.

Solution

You will need to post a UI Message from inside the TestStand process model or from inside modelsupport2.dll  to call the close sequences and return to the User Interface to finish the shutdown process. 

In TestStand or ModelSupport2.dll, locate where the button is being called. For Example, the Exit Button on the UUT Information box is located inside batchuutdlg.c and called BUUT_ExitDialog.
 
 
 
Posting the UI Message when the "EXIT" Button is pressed
 
Adding the lines for TS_SeqContextGetThread and TS_ThreadPostUIMessageEX will create a reference to the Sequence Thread calling the exit the button and then post a new UI Message.

After posting the UI Message, modify you UI file to fetch the UI Message and then initiate the Shutdown process. This is further detailed in Using TestStand User Interface Messages (UI Messages) to create a case to shutdown the engine and User Interface. 

Additional Information

With the above method, there will be an error returned for not closing the reference to the thread. It is important to close this reference in the error case so that the shutdown continues correctly.
Closing the sequence thread to prevent error
 
When modifying the process model to exit CVI, TestStand will post user questions about terminating executions and how to abort them. These are suppressed in the attached example so that they do not prompt for user input and the Exit Button seamlessly exits the UI and executing sequence

WAS THIS ARTICLE HELPFUL?

Not Helpful