NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Terminate execution from DLL file?

How do I terminate the execution of a sequence, from a DLL file? I'm using pure C++ and the DLL adapter in TestStand.

I tried 'execution->Terminate;', but no effect.

What would be the approach to make the sequence execution goto cleanup (still using C code from a DLL file)?
0 Kudos
Message 1 of 10
(6,558 Views)
Hello!

I need more information about what you are trying to achieve before I hopefully might be able to give you some hints and tips.

Is the DLL a part of the sequence file you want to terminate? Does the DLL have the sequence context (the actual one) as an input so you can mix with this? If you have the sequence context as an input and the DLL is part of the sequence file it is really easy to achieve what you want to do:

Just extract the execution object from the sequence context, then choose the method you want to use in this case the terminate method.

Regards,
Jimmie A.
Application Engineer, National Instruments
Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 2 of 10
(6,536 Views)
Hi,

I have found the problem. My execution pointer was not correct. But after correcting this matter, things work ok.
0 Kudos
Message 3 of 10
(6,489 Views)
I'm trying to do the same thing, but through CVI. How can I determine when the "Terminate Execution" is pressed in CVI?
0 Kudos
Message 4 of 10
(6,269 Views)
Hey Steve,

Are you calling a CVI dll from TestStand, and do you want to kill the TestStand sequence from the CVI dll?  If that is the case, you will need to pass the sequenceContext to the CVI dll (and reference the TestStand API).  When inside the CVI dll you can get the Execution Object from the sequenceContext that you passed in.  From the Execution object you can call the Terminate method, which will terminate the currently running sequence.  I hope this helps.
Best Regards,
Software Engineer
Jett R
0 Kudos
Message 5 of 10
(6,246 Views)
Yes. I'm calling the CVI dll from teststand.
I already pass the sequence context into the DLL. What function do I call to determine whether the button is pressed? What input parameters do I use? Thanks.
0 Kudos
Message 6 of 10
(6,242 Views)
Hey Steve,

I wrote a small dll in CVI that will wait indefinitely in the DLL step until the Terminate Button is pressed in TestStand.  The code is below.  I hope this helps.

void __declspec(dllexport) __stdcall WaitUntilTerminateIsPressed(CAObjHandle SeqContext)
{
    TSObj_Property TermMonitor;
    TSObj_Execution ExcObj;
    VBOOL TerminateBool;       
   
    TS_SeqContextGetExecution (SeqContext, NULL, &ExcObj);
   
    TS_ExecutionInitTerminationMonitor (ExcObj, NULL, &TermMonitor);
   
   
    TerminateBool = VFALSE;     
   
   
    while(TerminateBool == VFALSE)
    {
       
        TS_ExecutionGetTerminationMonitorStatus (ExcObj, NULL, TermMonitor, CA_DEFAULT_VAL, &TerminateBool);

        Delay(.1);
    }      

}

Best Regards,
Software Engineer
Jett R
0 Kudos
Message 7 of 10
(6,229 Views)

"Just extract the execution object from the sequence context, then choose the method you want to use in this case the terminate method."

 

I also would like to do exactly this. However, how do you extract the execution object? I am passing "Runstate.Engine" to my DLL, but I am unsure of who expects what from the Teststand Automation Interface. 

0 Kudos
Message 8 of 10
(5,762 Views)

Hi,

 

I have a sequence called "DUT initialization". When this sequence is failed i want to terminate the test stand execution without going to cleanup.

 

Please anyone help on this how to integrate this in test stand??

 

Regards,

Bharathi T

0 Kudos
Message 9 of 10
(5,648 Views)

Hello,

 

I am not sure if you still need it, this one seems to be what you are searching for:

http://forums.ni.com/t5/NI-TestStand/How-to-programmatically-terminate-a-sequence-execution-in/m-p/9...

 

 

Kind regards, Roman

0 Kudos
Message 10 of 10
(4,923 Views)