LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Kill RT task frontpanel RED-X versus WIN32-API

I have a LabVIEW task compiled to EXE which is downloaded to a remote processor; the front panel remains open locally.

 

I want to kill that task and re-download it. This works the way I want if I use the local mouse to click the RED-X kill box on the upper right corner of the local front panel for the remote task... The panel disappears AND the remote task stops executing.

 

The problem is that when I use the WIN32-API to try and kill the local front panel for the remote task I never get the remote task killed. Some  WIN32-API calls such as sending EndTask via USER32.DLL to the local panel's window ID cause the local panel to close but the remote task keeps running and is not aborted. Sending a WM_Close to the local panel's window ID involves the operator because it produces a LabVIEW dialog asking me whether I "want to close all RT tasks or not"

 

What message do I send to the window, or what system call do I envoke to get the same result as that simple local mouse click on the RED-X kill box on the upper right corner of the local front panel for the remote task?

 

Thanks, Jerry

0 Kudos
Message 1 of 4
(2,964 Views)

Hello.

 

Normally a Real-Time task does not require a front panel so closing the Front Panel that you have opened remotely does not necessarily cause the VI to stop running, it merely disconnects the front panel connection to the VI.

 

In order to achieve the same resul, you can use an Invoke Node to close another VI.

To do this you will need to follow the steps outlined below.

  1. Open a blank VI and place an Open VI Reference on the block diagram.
  2. Create a control to the "VI Path" input of the Open VI Reference. On the front panel you will need to browse to the VI you want stopped.
  3. Wire an Invoke Node to the Open VI Reference and set the Invoke Node to "Abort VI."
  4. Wire a Close Reference to the Invoke Node.
  5. Wire a General Error Handler to the Close Reference.
  6. Open the VI that you want to stop. Make sure it is running and then run the vi you just created. This will stop the first VI.

 

 

Hope this helps! 

Kameralina

Message 2 of 4
(2,891 Views)

Thank you for the reply...

 

Your idea is potentially useful to me, I might be able to use that method to download a 'killer' task to the remote processor which would open a reference to the headless process and abort the headless process, then automatically exit leaving no task running so I can download the main task again.

 

I am still wondering though; what is the communication that causes the remote processor task to completely exit remote processor memory when I mouse-click the "RED-X" kill box window decoration on the local front panel?

 

Jerry 

0 Kudos
Message 3 of 4
(2,888 Views)

If you stay connected to a target in LabVIEW 8.x, then closing the local copy of the VI will cause it to stop running on the target.  With earlier versions, yes you do get a prompt Exit LabVIEW without closing RT Engine VIs.

 

From the MSDN website, it seems that WM_CLOSE can prompt the user, and if they agree, WM_DESTROY will be called to Destroy the Window.

 

Hopefully this can lead you to your answer. 

Kameralina

Message 4 of 4
(2,866 Views)