
Can VB return exit code on program termination as exit(X) in C
Quote:
>Interesting.... I think I will try this. I based my (perhaps rash) response
>on the following snippet from chapter 11 of {*filter*} Visual Basic:
>"Visual Basic itself returns an exit code when launched from the command
>line, but it doesnt provide any means for you to set an exit code in your
>own programs. (If youre thinking you could call the ExitProcess API
>yourself, forget it. I tried that, but the exit code you set doesnt show
>up on the outside.)"
I have used it and it works fine for me. You must be VERY careful to free
up all objects/etc before calling it because your app will end immediately
and not go through normal termination/cleanup routines. If you call your
app from a bat file you have to use the START /WAIT command because
otherwise the app runs in parallel with the dos environment and that
eliminates the chance to get the code. In general I prefer to have the VB
app create a file and record the termination info if needed but there are
cases where the exit code is the best way.