12-03-2009 12:03 PM
I am trying to terminate an execution by clicking a button in CVI. Just a simple button, but I don't know how to get the SequenceContext. Here is what I have:
int CVICALLBACK TerminateButton (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
CAObjHandle seqContext;
TSObj_Execution excObj;
ERRORINFO errorInfo = { 0, 0, "", "", "", 0, 0 };
ErrMsg errMsg = "";
int error = 0;
tsErrChk(TS_SeqContextGetExecution (seqContext, NULL, &excObj));
tsErrChk(TS_EngineTerminateAll (seqContext, NULL));
QuitUserInterface(0);
break;
}
Error:
return 0;
}
12-03-2009 01:49 PM
I am not sure how you are getting to the TestStand Engine. Did you place an ActiveX control object from the TestStand Engine Class, or lanch testand using TS_NewEngine which gives you a Handle to the TestStand Engine. You want to use that in your call to TS_EngineTerminateAll.
ex
{
CAObjHandle engineObj = 0;
ERRORINFO errorInfo;
TS_NewEngine(NULL, &engineObj); // Creating new instance of TestStand
...
TS_EngineTerminateAll(engineObj, &errorInfo);
}
If you placed an ActiveX control on a panel in your uir, you can get the handle by the following:
GetObjHandleFromActiveXCtrl(panel, PNL_ENGINE_CTRL, &engineObj )
// panel is a handle to the panel
// PNL_ENGINE_CTRL is the control ENGINE_CTRL on panel PNL.
Hope this helps.
Mike