LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to: Close Application Properly

Solved!
Go to solution

 

With the event structure of that VI.  Which calls the panel close of the VI that called it, then the panel close of itself.  Just like I showed.

0 Kudos
Message 11 of 42
(2,525 Views)
The event structure can sense the closing of a VI window and, optionally, ignore it.  Allowing you to close the VI (or not) with your own code.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 12 of 42
(2,524 Views)
Cheers guys.  I will try it once I get my app builder working again 😞
0 Kudos
Message 13 of 42
(2,518 Views)

When using the cross (x) to close UI VI the window closes but the application hangs in the Task Bar (Manager).

 

I'm using the Application Closed? event in the UI VI.  Obviously the calling VI is not getting shut-down.

 

In the UI VI this is what I do for Event Application Closed?

 

1. Disregard with False.

2. Stop the While Loop.

3. Close the Front Panel.

4. Exit LV VI.

0 Kudos
Message 14 of 42
(2,496 Views)
Solution
Accepted by topic author battler.

Have you read anything that I or others have written in our messages?

 

I have never used Application Instance Close.  I said to use Panel Close? event.  That is the one associated with the window X.  Wire a True to the Discard? terminal.  You don't want the panel to actually close until you've done all of your cleanup code.

 

To close the calling VI, you will have to use a reference to that VI and call the Front Panel Close method.  Then when that is done, then you can call the Front Panel Close method for the UI VI that you have open.  You can pass in a reference to the calling VI through the connector panel of the called VI when you call the subVI.

 

You still haven't said why you even have a calling VI.

0 Kudos
Message 15 of 42
(2,491 Views)

It is clear to me now.  I was simply using the wrong Event.

 

I was doing the other things you suggested such as passing the calling VI ref.  That's why I gave you Kudos for the suggestion.  

 

Works great.  Thanks for your help.

0 Kudos
Message 16 of 42
(2,491 Views)
Excellent.  I'm glad it's working for you now.
0 Kudos
Message 17 of 42
(2,486 Views)
Just a suggestion, that close vi method isn't very reliable in version 8.x.  I haven't tried version 9 yet so I dunno if NI ever fixed it.  From my experience with this method, many times it freezes my application instead of exiting it.  Which is really annoying.  If you have application developer edition and planning on building into an executable and you know the name then sneak in a task kill command.  For example, you compile your program into testProgram.exe.   Create a bat file and execute it with this command "taskkill /f /im testProgram.exe".
Message Edited by lavalava on 04-02-2010 10:50 PM
0 Kudos
Message 18 of 42
(2,485 Views)

I haven't heard of any problems with that method.

 

If you are having a problem, start a new thread and attach a VI that demonstrates it.  Perhaps something else is going on in your VI that is causing you a problem.

0 Kudos
Message 19 of 42
(2,482 Views)
You may have been having trouble with the VI reference you were using.  I have heard and dealt with trouble using that before.
0 Kudos
Message 20 of 42
(2,463 Views)