For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > May 2005 > Returning status code from VB exe









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Returning status code from VB exe
Matti

2005-05-25, 3:55 pm

How do I return a status code fom a VB (6) program, so that I can test it in
..BAT command file.
Matti


Bob Butler

2005-05-25, 3:55 pm

"Matti" <me@here.invalid> wrote in message
news:uo5EZYUYFHA.2128@TK2MSFTNGP14.phx.gbl
> How do I return a status code fom a VB (6) program, so that I can
> test it in .BAT command file.


Private Declare Sub ExitProcess Lib "kernel32" _
(ByVal uExitCode As Long)

Be careful using it as it is a very abrupt termination. Make sur eyou have
unloaded all forms, closed all files and done all cleanup first. You should
also avoid calling it when running in the IDE since it will kill your VB
session without saving.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Karl E. Peterson

2005-05-25, 3:55 pm

Matti wrote:
> How do I return a status code fom a VB (6) program, so that I can
> test it in .BAT command file.


Echo everything Bob said, plus offer these examples:

http://vb.mvps.org/samples/Console
http://vb.mvps.org/samples/Hello

Be careful...
--
Working Without a .NET?
http://classicvb.org/petition


Phill. W

2005-05-26, 3:56 pm

"Bob Butler" <tiredofit@nospam.com> wrote in message
news:Oum8HcUYFHA.3620@TK2MSFTNGP09.phx.gbl...
> "Matti" <me@here.invalid> wrote in message
> news:uo5EZYUYFHA.2128@TK2MSFTNGP14.phx.gbl
>
> Private Declare Sub ExitProcess Lib "kernel32" _
> (ByVal uExitCode As Long)
>
> Be careful using it as it is a very abrupt termination. Make sur eyou

have
> unloaded all forms, closed all files and done all cleanup first. You

should
> also avoid calling it when running in the IDE since it will kill your VB
> session without saving.


and remember to use

start /wait VBProgram.exe

in your batch file, so that it actually /waits/ for the VB program to
/finish/ before sampling the return value.

HTH,
Phill W.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com