From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I force labview to quit even if there are vi's running, without user intervention?

Hi all,

We have an application where a really remote system sometimes has to shut down and reboot.  The problem is that because labview is running various VIs, the shutdown sequence gets stuck at the message from labview which says "Quitting will abort all running VIs".  If someone were there, it would be no problem, that person would just click "quit", and the shutdown would proceed.  The problem is that the computer is miles away, in the middle of nowhere, and no one is around to press the "quit" button.

So how can I force labview to quit while preventing that dialog box from stopping the shutdown?

We're using Windows XP, and Labview 7.1

Thanks!

Peter Halverson


0 Kudos
Message 1 of 13
(6,859 Views)

In cases your Vi doesnt require saving, you can use a shared variable to control a state machine with "quit Labview" icon in. you will find it in the application control menu.

of course that demands using labview on your server and sending this variable before other system commands. on top of that that will require to add a running vi in your remote computer, which have just a loop and an event structure (with timeout of some 100ms), for handling the labview shutdown. this should not be too difficult tough.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
Message 2 of 13
(6,850 Views)

Hi Peter,

Here's another possibility: (though it seems rather drastic) this VI uses .NET to kill a named process - in this case LabVIEW - if the "Application Instance Close?" event is detected.  It seems "Application Instance Close?" " is fired at the same time as the "Quit/Cancel" dialog.Smiley Surprised

It would be launched in parallel to everything else and takes an occurrance input - if your app terminates normally, set the occurrance to kill this VI.

Caveat#1: It requires .NET

Caveat#2: It's written in LV 8.2 because LV 7.1. .NET constructors weren't working for me today!

Caveat#3: You'll need to change the process name from "LabVIEW" to that of your .EXE - if the app is compiled.

Caveat#4: This is a terrible way to stop a program! - Smiley Wink - are you sure the remote-program can't be made smart enough to detect the error-condition and shut-down "gracefully"?

Cheers!

Message Edited by tbd on 07-08-2007 04:33 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Download All
0 Kudos
Message 3 of 13
(6,852 Views)
Hey Peter,
      I'm having doubts whether this will work in L.V 7.1, but here's a diagram in case you want to try it.
Cheers!

Message Edited by tbd on 07-08-2007 04:54 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 4 of 13
(6,842 Views)

In principle, I would say that this kind of behavior is anomalous and should be examined - finding out why the VIs are not stopping and resolving that issue.

As for tbd's suggestion, 7.1 specifically had some issues with .NET constructors. There was a patch which resolved the issue.

If you want to avoid .NET, Windows also has a simple kill command for killing processes.


___________________
Try to take over the world!
Message 5 of 13
(6,836 Views)
I would agree with tst. There is an application shutdown event that your program should be trapping and using to stop itself.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 13
(6,823 Views)

I would agree with tst too! Smiley Wink (see Caveat #4 in my post)

tst, thank you for the heads-up re: patching 7.1 .NET.

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 7 of 13
(6,806 Views)

Yep, tst is right, definitely the easiest way around.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 8 of 13
(6,754 Views)

I wrote a VI that calls the WinAPI to force quit LabView for this Idea Exchange post, but it doesn't let me add attachements, so I am attaching it to this ancient thread.

 

Running this VI will terminate the running LabView process with no dialog boxes, losing all of your work, etc.

0 Kudos
Message 9 of 13
(4,755 Views)

Thanks, Rob_Calhoun! I'm really interested in your VI, but I have LV 2013. Would you be able to attach a compatibilty version?

0 Kudos
Message 10 of 13
(4,518 Views)