LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Window's Close Box

Hi, I was wondering if anybody could answer my question pertaining to the

close box (little X button on top right of window). Do you know if labview

gets a signal when this button is pressed and the window is closed?
For example, I need to write to my log file that the program was shutdown
but if they hit the X, the program doesn't know it shut down. The only
solution so far is to just disable the button, but i would really like to
have
it enabled.

Thanks,
James
0 Kudos
Message 1 of 8
(3,070 Views)
"James D." writes:

> Hi, I was wondering if anybody could answer my question pertaining to the
>
> close box (little X button on top right of window). Do you know if labview
>
> gets a signal when this button is pressed and the window is closed?
> For example, I need to write to my log file that the program was shutdown
> but if they hit the X, the program doesn't know it shut down. The only
> solution so far is to just disable the button, but i would really like to
> have
> it enabled.
>
> Thanks,
> James

James,

Labview should get the signal like any other program. Word editors ask
to save open files this way.

Another question is how to capture the signal. It might be send to the
"developing environment" (labview.exe) and not
your vi. I'm not a
windows programmer so I don't know the right dll and function. It
should be in one of the most basic dll's.

Johannes Niess
0 Kudos
Message 2 of 8
(3,070 Views)
I use VI Server and the "Front Panel Open" Property Node to test to see
if the user has closed the app via the X (close) button. The Front Panel
property tells you if the app is running.
If the Front Panel is open (True), let the program continue, if the Front
Panel is
closed (False), clean-up and close.

Regards,

Alan Brause




James D. wrote in message
news:384ea1da@newsgroups.ni.com...
>
> Hi, I was wondering if anybody could answer my question pertaining to the
>
> close box (little X button on top right of window). Do you know if
labview
>
> gets a signal when this button is pressed and the window is closed?
> For example, I need to write to my log file that the program was shutdown
> but if they hit the X, the program doesn't know it s
hut down. The only
> solution so far is to just disable the button, but i would really like to
> have
> it enabled.
>
> Thanks,
> James
0 Kudos
Message 3 of 8
(3,070 Views)
Closing a window using the X in the upper corner can have unpredictable
results. If a loop is running wait for a front panel control the VI will
keep running after the X is pressed only you won't be able to see it!
Essentially when you click the X you are telling the VI to close the front
panel, there is no other effect. To allow this to be a usable feature you
must open a VI reference to the VI being displayed and use a property node
to check to see if the front panel is open. Then you can wire this front
panel open property in with your VI control for exit using logic and decide
for yourself want you want to happen when the X is selected.

I can send an example, email me directly.

Jim Morrison
Rendezvous Bay Software



"James D." wrote:

> Hi, I w
as wondering if anybody could answer my question pertaining to the
>
> close box (little X button on top right of window). Do you know if labview
>
> gets a signal when this button is pressed and the window is closed?
> For example, I need to write to my log file that the program was shutdown
> but if they hit the X, the program doesn't know it shut down. The only
> solution so far is to just disable the button, but i would really like to
> have
> it enabled.
>
> Thanks,
> James
0 Kudos
Message 4 of 8
(3,071 Views)
Dpends on your version of labview. I was having a similar problem. As far as I know, it is not possible in older versions of labview. With Labview 6.1 you can use an event structure to capture the from panel closing.
0 Kudos
Message 5 of 8
(3,071 Views)

Could you please help me.  I don't understand the reply you made in 2000.  When I close the window of a VI it aborts all execution.  How can I get it to continue to run?

 

see test.vi

0 Kudos
Message 6 of 8
(2,796 Views)
Look at the shipping example called Event Conditional Stop. It uses the event structure with the application exit? and panel close? events.
Message 7 of 8
(2,789 Views)
Thank you dennis.
0 Kudos
Message 8 of 8
(2,782 Views)