@Dennis Knutson wrote:
Again, the answer is an event structure. One of the events you can capture is Application Exit. Look at the shipping example called Event Conditional Stop. It has an event for the front panel stop button, clicking the X button/File>Exit, and File>Close.
There was actually also a way to do that before the event structure. It was a little bit more involved. You basically opened a VI reference to its own VI as one of the first things in a GUI VI and stored that reference in a loop. Then in your state machine idle polling you also polled the Front Panel.Open property through this VI reference. If that property went FALSE this meant the user had selected the little X in the top right corner (or System Menu->Close). Since you still had a VI reference open to the VI it didn't abort and you could push an "exit" operation on the state machine queue (including maybe a dialog box "Do you really want to quit the application?"
😉 to clean up whatever needed to be cleaned up, after which you left the state machine loop and as last thing closed the VI reference which closed the VI definitely.
Rolf Kalbermatter
Message Edited by rolfk on 06-28-2005 06:38 PM
Rolf Kalbermatter
My Blog 
DEMO, Electronic and Mechanical Support department, room 36.LB00.390