LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The root cause for the case that "cannot close labview-generated exe file"

Hi All, I have a big program including a lot of things. When I converted it to an exe file, it cannot be closed properly. I used to load the dynamic vi in this program and cannot close it by clicking "X" of the window. Now I have removed that dynamic load but still cannot close the exe. Could anyone give me some advice? Thank you!

0 Kudos
Message 1 of 14
(2,958 Views)

Assuming your program closes OK in the development environment, the first item may not be your problem but just in case ...

 

1) Each looping structure must have an exit strategy (i.e. "a way to terminate") when you close the program

 

    Make sure that all your loops are completing.

 

2) Vis with event structures tend to need some help to close their front panels

 

    I use the following code:

 

close fp.png

 

The other case is Development System (empty).

Not required, but using the "App.kind" property node like this prevents the vi from closing in the development environment.

 

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 14
(2,940 Views)

Hello

 

it is difficult to predict the reasons, with the limited information. show us some pictures of how the executable stays when you close it.

 

for now, questions:

how are you closing the EXE? Panel close (X) on the top right corner/stop or exit button on the GUI? Or are you using a FP Close invoke node?

how are you handling the event for Panel close or for Stop/exit button?

how many loops are running in parallel inside the EXE? how are you stopping those loops when the panel is closed or a Stop/Exit button is pressed.

have you checked if all the loops are closing when you stop the EXE?

 

does this work well when you run the source code? have you checked for any errors when yuo stop your EXE?

 

when you say it cannot be closed properly, there could be two things:

1. the front panel/GUI does not close and it stays there. you cannot perform any GUI actions, or it seems to have hung.

2. the GUI closes but you can still it in the task bar below, you will have to use the Task manager to force close the executable.

 

which of the above points are relevant?

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 3 of 14
(2,940 Views)

Hi Freelance_LV, thank you for your advise, here is a program for a USB dongle. Here are the answers:

 

for now, questions:

1. how are you closing the EXE? Panel close (X) on the top right corner/stop or exit button on the GUI?

[A] I use (X) on the top right corner but it did not work. But when I use exit button on the GUI it worked.

 

2. Or are you using a FP Close invoke node?

[A] No

 

3.how are you handling the event for Panel close or for Stop/exit button?

[A] events are inside a sequence frame

how many loops are running in parallel inside the EXE?

[A] It is hard to tell. I am not the original creator of this code, but the main structure is this: a big "for" loop, inside there are some sequence frame, and some events in one of the frame.

how are you stopping those loops when the panel is closed or a Stop/Exit button is pressed.

[A] the main loop inlcudes some events, sequence frame, and something like this. And there is a subvi from some previous people's work to close USB. 

have you checked if all the loops are closing when you stop the EXE?

[A] Sorry I don't know how to check all the loops are closed.

does this work well when you run the source code?

[A] yes source code can be always be closed well.

have you checked for any errors when yuo stop your EXE?

[A] sorry I don't know how to check for errors?

 

when you say it cannot be closed properly, there could be two things:

1. the front panel/GUI does not close and it stays there. you cannot perform any GUI actions, or it seems to have hung.

[A] Yes GUI still there. But cannot perform any GUI actions.

2. the GUI closes but you can still it in the task bar below, you will have to use the Task manager to force close the executable.

[A] Not this case.

 

Thank you very much!

 

0 Kudos
Message 4 of 14
(2,918 Views)

Hi Steve, is the picture you post your complete solution to close the GUI? If not, could you share with me this specific part of code? Thank you!

0 Kudos
Message 5 of 14
(2,912 Views)

@bhl3302 wrote:

Hi @Freelance_LV, thank you for your advise, here is a program for a USB dongle. Here are the answers:

 

for now, questions:

1. how are you closing the EXE? Panel close (X) on the top right corner/stop or exit button on the GUI?

[A] I use (X) on the top right corner but it did not work. But when I use exit button on the GUI it worked.

 

 


 

Use the "Panel Close?"  event.  (not "Panel Close")

Wire True to the Discard? option.

Copy the code being executed when hitting the GUI stop button.

 - I usually do this outside my main while loop.

 - Another option might be to use a value change (signaling) property node on the GUI stop button.  This does not work on momentary/single pulse buttons.

 

Adam

0 Kudos
Message 6 of 14
(2,906 Views)

Hi Adam,

 

If I just want to use the "X" on right top side of the window of exe file to close the program, could you tell me how? Thank you very much!

0 Kudos
Message 7 of 14
(2,903 Views)

Hi Steve, I am trying to use your solution but got the problem in connecting this block to event case. Here is the snapshot. Could you take a look? Thank you!cannot connect.PNG

0 Kudos
Message 8 of 14
(2,902 Views)

in how many directions is your data flowing!!Smiley Surprised

 

please post the full VI. we cannot help much with the image you uploaded.

 

also, if you want to use the X button on the top rigth corner of the window, then add an Event case to the event structure for Panel Close event. if you post your code, we can tell you in more detail, what can be done

 

 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 9 of 14
(2,895 Views)

Assuming you already have an event structure for GUI inputs....

 

1. Create a new event:   <This VI>  -> Panel Close?

2. Wire a true to Discard?

3. *Execute the code that is being run on a GUI Stop button command.*

4. Use (This VI) invoke node Front Panel.Close   to close the vi after execution completes.

 

If you don't mind your VI running in the background until it finishes closing up shop, you can skip steps 2 and 4.

 

Without seeing your code, it will be difficult to give you more help other than these generalizations.

0 Kudos
Message 10 of 14
(2,883 Views)