LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW closes while VI's are still running in the background

I have created a large application that is split between VB 6 and LV 6.1. The LabVIEW portion runs in the background, except that the VB portion can request that a LabVIEW user interface be presented on demand. Any time after this LabVIEW user interface has been opened and closed, opening and closing another application (or even just hiding a top-level window in another application) will cause LabVIEW to close, taking my background processing with it.

If the LabVIEW code is running as source code, LabVIEW prompts me before closing. However, when the LabVIEW code is running as an executable (.exe), the executable closes without prompting in this circumstance.

The scenario can be reproduced with a standard LabVIEW sample program. Proceed as follows:

1) Open VBToLV.vbp (the example program distributed with LabVIEW 6.1).
2) Start the VB program running.
3) Press the Launch LabVIEW button on the user interface of the VB program.
4) Enter an expression in the text box provided.
5) Select Display VI Front Panel.
6) Press the Run VI button.
7) Close the VI front panel by clicking its "X" button.
😎 Open any handy application, such as Windows Explorer or Notepad.
9) Close this most-recently-opened program.
10) The LabVIEW Exit screen appears.
11) Exit LabVIEW.
12) Press the Run VI button.
13) An error occurs because LabVIEW has closed.

If the LabVIEW code had been built into an executable and called accordingly, there would have been no LabVIEW exit screen. The executable would have just exited silently.

This is not the way a COM server is supposed to behave. The VB program is still holding a valid reference to the server and it should remain open.

It appears that LabVIEW is monitoring the total number of top-level windows that are open. I suppose that this is how LabVIEW figures out when its own FP windows have been closed. In this case, it doesn't notice that all of its windows have been closed until some other window closes.

I have a work-around, but it's ugly.

Ron Martin
Balance Technology Inc.
0 Kudos
Message 1 of 6
(3,960 Views)
Hi,

Perhaps you use references to windows in LabVIEW. If you get those
references with a full path (e.g. c:\code\subvis\vi1.vi), this will work
while in LabVIEW environment. But when an application is build, this will
fail, because the vi is no longer there. Try using the name in a string
instead (the OpenVIReference is polymorphic) with only the name of the vi in
it (e.g. vi1.vi).

There are some other isues that change when building an application. Most of
them are paths that change, and references that fail to open because of
them.

Regards,

Wiebe.

"cpuwzd" wrote in message
news:506500000008000000DAA20000-1042324653000@exchange.ni.com...
> I have created a large application that is split between VB 6 and LV
> 6.1. The LabVIEW portion runs in the background, except that the VB
> portion can request that a LabVIEW user interface be presented on
> demand. Any time after this LabVIEW user interface has been opened
> and closed, opening and closing another application (or even just
> hiding a top-level window in another application) will cause LabVIEW
> to close, taking my background processing with it.
>
> If the LabVIEW code is running as source code, LabVIEW prompts me
> before closing. However, when the LabVIEW code is running as an
> executable (.exe), the executable closes without prompting in this
> circumstance.
>
> The scenario can be reproduced with a standard LabVIEW sample program.
> Proceed as follows:
>
> 1) Open VBToLV.vbp (the example program distributed with LabVIEW 6.1).
> 2) Start the VB program running.
> 3) Press the Launch LabVIEW button on the user interface of the VB
> program.
> 4) Enter an expression in the text box provided.
> 5) Select Display VI Front Panel.
> 6) Press the Run VI button.
> 7) Close the VI front panel by clicking its "X" button.
> 😎 Open any handy application, such as Windows Explorer or Notepad.
> 9) Close this most-recently-opened program.
> 10) The LabVIEW Exit screen appears.
> 11) Exit LabVIEW.
> 12) Press the Run VI button.
> 13) An error occurs because LabVIEW has closed.
>
> If the LabVIEW code had been built into an executable and called
> accordingly, there would have been no LabVIEW exit screen. The
> executable would have just exited silently.
>
> This is not the way a COM server is supposed to behave. The VB
> program is still holding a valid reference to the server and it should
> remain open.
>
> It appears that LabVIEW is monitoring the total number of top-level
> windows that are open. I suppose that this is how LabVIEW figures out
> when its own FP windows have been closed. In this case, it doesn't
> notice that all of its windows have been closed until some other
> window closes.
>
> I have a work-around, but it's ugly.
>
> Ron Martin
> Balance Technology Inc.
0 Kudos
Message 2 of 6
(3,960 Views)
I believe what is happening is that a LabVIEW executable must have at least 1 open front panel to continue executing. If you create a LabVIEW executable and then close the front panel of the VI you will notice the same bevaior; the executable just stops. A work around is to create a dummy panel that you make very small and you move it to be wither off the screen or way in a corner so it is not seen. You then open this panal and leave it open always.
0 Kudos
Message 3 of 6
(3,960 Views)
This is essentially the work around that I implemented. I still consider this behavior to be a bug in LabVIEW. There is no reason for LabVIEW to be watching non-LabVIEW windows to see when they close and there is no reason that a VI shouldn't be allowed to continue running in the background just because a LabVIEW window has been closed.
0 Kudos
Message 4 of 6
(3,960 Views)
I too had this problem with LabVIEW 6.1 and I used the same work around. There have been other posts related to this [Click for Other Post] . But this has been addressed in LabVIEW 7. With LabVIEW 7 VI server, you can define the front panel to be hidden, normal (showing), maximised or minimised... a very handy feature. Using 7 I managed to hide the front panel of a LabVIEW exe without a glitch. Hope that helps....

Charles.
0 Kudos
Message 5 of 6
(3,959 Views)
It would help if I could talk my client into letting me use LabVIEW 7. I don't know if his site license covers it. I might also have to talk my employer into letting me spend whatever time is necessary to convert 250-300 VI's from one version to the other.

I haven't even figured out whether I can install both versions on the same computer without conflict and I don't have time to try it without some confidence that it won't be a problem.

Ron Martin
Balance Technology Inc.
0 Kudos
Message 6 of 6
(3,959 Views)