Can VB return exit code on program termination as exit(X) in C 
Author Message
 Can VB return exit code on program termination as exit(X) in C

No.





Thu, 08 Mar 2001 03:00:00 GMT  
 Can VB return exit code on program termination as exit(X) in C

Yes... see http://home.earthlink.net/~butlerbob/vb/tasks/exitcode.htm



Thu, 08 Mar 2001 03:00:00 GMT  
 Can VB return exit code on program termination as exit(X) in C
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.)"

-Andy.



Quote:

> Yes... see http://www.*-*-*.com/ ~butlerbob/vb/tasks/exitcode.htm



Thu, 08 Mar 2001 03:00:00 GMT  
 Can VB return exit code on program termination as exit(X) in C
<

Use ExitProces API.
But, do all your cleanup before using it.
    Unload Me
    ExitProcess 2
If you try this in VB IDE, it will also close your VB, without any
warning.

Bruno Paris
Ameba
to reply via email, remove nospam_



Thu, 08 Mar 2001 03:00:00 GMT  
 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.


Thu, 08 Mar 2001 03:00:00 GMT  
 Can VB return exit code on program termination as exit(X) in C
Thanks for all the answers.

Back to DOS, can you remind how to force the batch file to wait until
the exe is done and not to permit it to run in parallel?

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.



Thu, 08 Mar 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Howto: return exit code from a VB program

2. Return exit code from VB program

3. Return an exit-code from a running VB 6 application

4. Haw do I return a VB exit code ?

5. How do I code a menu Exit to exit

6. vb_dotnet thread: Problems with VB.NET : The program has exited with code 0

7. VB Program - SQL Job Step - Process Exit Code

8. Return values on program exit

9. How to return exit code

10. How returning an exit code from VB6

11. Exit ap with a return code

12. Exit Return Code

 

 
Powered by phpBB® Forum Software