03-20-2025 06:42 AM
I want to make sure an application closes the serial port it’s using when the window is closed using the red X in windows. Is there a way to perform some specific case or something similar when that button is hit before the window closes?
03-20-2025 07:05 AM
03-20-2025 07:19 AM - edited 03-20-2025 07:20 AM
Event Structure. The event you want to use is the <This VI>->Panel Close event. This will be triggered when you try to close the window. What I usually do is use the Filter Event version (has the ? at the end of the name). I then discard the event (stopping the closing of the window), stop the loop, and then do whatever extra clean up is required after the loop. I can then use the Front Panel->Close method to close the window if so desired.