NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to terminate an executalbe what is running in a multi-thread/new executed sequence.

Hi all
 
I run an application by "Call Executalbe" in a multi-thread/new executed subsequence and monitor the status in main sequence, I would like to terminate the executable in Main sequence or other subsequences at correct time.  I tried to call TestStand API "Terminate", but didn't help.
 
How to achieve?
********************************
*The best Chinese farmer*
********************************
0 Kudos
Message 1 of 8
(4,584 Views)

Hi Paulbin

i took a look into the source code of the steptype CallExecutable (C:\Programme\National Instruments\TestStand 4.0\Components\NI\StepTypes\CallExec\callexec.c).
If you select in the step settings at Wait Condition other than "No Wait" and set Flag Terminate Executeable if step is terminated ... to true. Then your executable

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 8
(4,576 Views)

Hi Paulbin

i took a look into the source code of the steptype CallExecutable (C:\Programme\National Instruments\TestStand 4.0\Components\NI\StepTypes\CallExec\callexec.c).
If you select in the step settings at Wait Condition other than "No Wait" and set Flag Terminate Executeable if step is terminated ... to true. Then your executable will

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 3 of 8
(4,575 Views)

Hi Paulbin

i took a look into the source code of the steptype CallExecutable (C:\Programme\National Instruments\TestStand 4.0\Components\NI\StepTypes\CallExec\callexec.c).
If you select in the step settings at Wait Condition other than "No Wait" and set Flag Terminate Executeable if step is terminated ... to true. Then your executable will be

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 8
(4,575 Views)
Hi Paulbin,
 
i took a look at the stepType's source. (C:\Programme\National Instruments\TestStand 4.0\Components\NI\StepTypes\CallExec\CallExec.h)
If you select in the step settings at Wait Condition other than "No Wait" and set the flag "Terminate Executable ... to True. Your executable should be terminated.
Note:
The StepType is using SDK Function TerminateProcess ! Take also a look at www.msdn.com  to get more information. Maybe will produce an unstable state on your
system, especailly when devices (IEEE,VISA,IVI) with uses handles. But dont know what your exe is doing.
 
Hope this helps
 
juergen 
 
OH!! Whats happend on this page !!! Forget the upper stuff !! seems i have to configure my Touch Pad Smiley Mad


Message Edited by j_dodek on 03-12-2008 04:35 AM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 8
(4,574 Views)

Hi Juergen

I can not find the flag "Terminate Executable " in TestStand3.1, the application called is a long process application for firmware download to a UUT, it will not be terminated by itself, so I would like to force it close at other place in sequence.

********************************
*The best Chinese farmer*
********************************
0 Kudos
Message 6 of 8
(4,551 Views)
Maybe you could use the TerminateProcess() function from kernel32.
0 Kudos
Message 7 of 8
(4,546 Views)
Hi Paulbin,
 
can you post the source code of TS3.1 callexec.c and the .uir file. I will take a look on it if this already is working in TS3.1. By the way there are two other solutions. If the TS3.1 StepType is providing a ProcessHandle you can use the suggestion from Liming. But this must be done in an asynronous way !. The second solution is creating an user step Type which the code of TS4.0 
 
greetings
 
juergen 
 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 8 of 8
(4,538 Views)