LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Application builder created executable does not close front panel when called

Solved!
Go to solution

I have a simple vi that I want to perform an action when I run it. I used application builder to create an executable. In the Vi Properties, I have the vi set to "close afterwards if originally closed". I figured that would mean that if I run the executable, even if the front panel does appear it would close itself upon sucessful running/completion of the vi. However, every time I run the exe the front panel appears and just stays there. This is a function I intend to run multiple times (think of it as a macro), so if I have to close out of the front panel manually each time I will get frustrated real fast. I tried changing some of the vi settings around but nothing really seems to be doing it.

 

Any help would be greatly appreciated.

 

Apologies, as I'm sure this is a simple thing that I am missing.

 

Thanks.

0 Kudos
Message 1 of 12
(907 Views)

Are you talking about the panel of the toplevel Vi or a subVI?

If this is a subVI, what makes the front panel appear?

0 Kudos
Message 2 of 12
(903 Views)

It is the toplevel Vi that pops up. There are subVIs in this program, but their panels do not pop up.

0 Kudos
Message 3 of 12
(899 Views)
Solution
Accepted by topic author JBatSRO

Add this to your VI.

Programmatically Exit or Close a LabVIEW Executable

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
Message 4 of 12
(848 Views)

Ok yeah, this seemed to work. Thank you!

 

Is this how all executable level VIs should be set up, if they are supposed to just fire and forget like this?

 

I guess the question I'm asking is, is this method a bandaid fix or a cure for the itch?

0 Kudos
Message 5 of 12
(796 Views)

Hi JBat,

 


@JBatSRO wrote:

Is this how all executable level VIs should be set up,


Yes, it is.

When your executable is about to stop it should call the QuitLabVIEW function as the very last step…

 

Suggestion:

Create a subVI, where you check the environment (EXE or IDE). Depending on this check you call either Quit or Stop function. Put this VI into your user lib and call it in all your main VIs as last step…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 12
(784 Views)

Ok, great, this is all very good to know. I implemented the vi quit and it worked exactly as i needed it to. I will have to see where else in my other VIs in other projects this will be effective.

 

Thank you all for your help!

0 Kudos
Message 7 of 12
(759 Views)

@GerdW wrote:

@JBatSRO wrote:

Is this how all executable level VIs should be set up,


Yes, it is.

When your executable is about to stop it should call the QuitLabVIEW function as the very last step…


Is this really true or necessary? I always read on this forum that this is like crashing your car into a wall to stop; it works, but using the brakes is preferred.

 

I use an occurence to fire the LabVIEW quit/exit only if the program is hanging. If the occurence does not occur within a set period of time, then fire the Quit LabVIEW; otherwise it should shutdown normally like any other program. Below is a mockup; of course the code needs to reach that point in execution for this to work.

 

mcduff_0-1718660829728.png

 

 

0 Kudos
Message 8 of 12
(746 Views)

Hi mcduff,

 


@mcduff wrote:

When your executable is about to stop it should call the QuitLabVIEW function as the very last step


Is this really true or necessary? I always read on this forum that this is like crashing your car into a wall to stop; it works, but using the brakes is preferred.


I agree on the "crashing a car" comparison - when there is a STOP/QUIT somewhere in the middle of program execution. But I wrote "as the very last step"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 12
(731 Views)

@GerdW wrote:

Hi mcduff,

 


@mcduff wrote:

When your executable is about to stop it should call the QuitLabVIEW function as the very last step


Is this really true or necessary? I always read on this forum that this is like crashing your car into a wall to stop; it works, but using the brakes is preferred.


I agree on the "crashing a car" comparison - when there is a STOP/QUIT somewhere in the middle of program execution. But I wrote "as the very last step"…


So then it acts as a "failsafe" closing LabVIEW as a last resort if some weirdness is keeping it open?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 12
(709 Views)