LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to produce exit code in standalone LabVIEW application

Hello everyone,

How does one produce an arbitrary exit code on exit from a standalone (compiled with Application Builder) LabVIEW application, similar to what C-language exit(err_code) function call does? Thank you. -Ed
0 Kudos
Message 1 of 9
(5,589 Views)
What does this C function do?
Do you want to send a code somewhere when you exit your application? If so, where to?

___________________
Try to take over the world!
0 Kudos
Message 2 of 9
(5,565 Views)
Hi - if the question is how to exit labview correctly after .exe produced using application builder.
The recommended method is to drop a LABVIEW EXIT (QUIT ) vi onto your wiring diagram, and wire it accordingly.
The vi is in the application control palette.
regads dht
Message 3 of 9
(5,557 Views)
The Event structure has an "Application Exit" event that is triggered when the user tries to exit the application. Trap this event and execute any code you need to from there.


LabVIEW, C'est LabVIEW

Message 4 of 9
(5,548 Views)
Sorry, I first understood that you wanted to "execute" some code at exit, instead of outputting an error code number.


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 9
(5,542 Views)
Hi there,

if you want to use %ERRORLEVEL% in your calling process of the LV-App call

void _exit(long code);

from MSVCRT.dll in your System32-Folder.

But remember: that kills your App immediatly!

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 6 of 9
(5,535 Views)


@chrisger wrote:
Hi there,

if you want to use %ERRORLEVEL% in your calling process of the LV-App call

void _exit(long code);

from MSVCRT.dll in your System32-Folder.

But remember: that kills your App immediatly!

best regards
chris




Thanks Chris! Do you know if that would be considered a "clean" (normal LabVIEW) exit? Would LabVIEW be able to do whatever "house keeping" it does upon regular application termination? -Ed
0 Kudos
Message 7 of 9
(5,517 Views)
/*
Thanks Chris! Do you know if that would be considered a "clean" (normal LabVIEW) exit? Would LabVIEW be able to do whatever "house keeping" it does upon regular application termination? -Ed
*/


hello

well, i would say "no". the call of exit kills the process, i.e. the instance of your LabView RTE. the only things cleaned up by the call of exit in a standard c-app are those initialized with atexit (if my memory hasn't left me). so, in your place i would clean all things opened by my self (files, DAQ, etc) BEFORE the call of exit, but the things opened by the LabView RTE (services etc.) may be just killed. but, for more info regarding exit visit msdn.com.

hmmm..
if you want to be save, you could create a textfile containing the errorcode at the end of your app, exit LabView RTE with the LV-Exit function, and then read the textfile in your batch (there are some batch-commands for such purposes)!

let us know
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 8 of 9
(5,501 Views)
Hi Everybody!

I second what dht said and would use the Quit LabVIEW VI to exit a LabVIEW executable running with the Run-Time Engine. This will provide the usual "house keeping" rather than just killing the application.

Travis H.
National Instruments
Travis H.
LabVIEW R&D
National Instruments
0 Kudos
Message 9 of 9
(5,445 Views)