Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can VB EXE's return codes

0 views
Skip to first unread message

Stephan Human

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to

Hi,

If you run a VB app without any UI, will you be able to return a code from
the executalbe which tells you if the process fails. The VB app executes
different processes, and must report back if any of them failed. This will
be used by another application calling it from the command line.

Please help

Thanks

Stephan

Khodr

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to

You can have at least 2 options:
1) Make the "executed" app write the results to a Log file, and make the
"Calling" application check and read the log file.
2) Make the "executed" app send an email using WinSock control should an
error occurs, to any valid email address you want.

I have the same kind of application that runs by itself on a remote machine
every one hour, with no user interface. It sends me an email, should any
error occurs.

Hope this helps.. Let me know if you need more help..

Good Luck..

Khodr


"Stephan Human" <stepha...@hotmail.com> wrote in message
news:OAMexCH...@cppssbbsa02.microsoft.com...

Chris Toney

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to

A better solution is to use Win32 API calls. Call ExitProces() to report the
error level when the app terminates. In the calling program, use the
CreateProcess() API to launch the app instead of VB's Shell() function.
Retrieve the exit code using GetExitCodeProcess(). Sample code is found in
two MS KB articles:

Q129796, HOWTO: 32-Bit App Can Determine When a Shelled Process Ends

Q178357, HOWTO: Set an Error Level from a Visual Basic Application


--
Chris Toney
Network Administrator
Cellular XL Associates
(d.b.a. CellularOne of Mississippi)

Tim Arheit

unread,
Oct 18, 2000, 3:00:00 AM10/18/00
to
On Tue, 17 Oct 2000 15:25:13 -0500, "Chris Toney"
<cto...@cellone-ms.com> wrote:

>
>A better solution is to use Win32 API calls. Call ExitProces() to report the
>error level when the app terminates. In the calling program, use the
>CreateProcess() API to launch the app instead of VB's Shell() function.
>Retrieve the exit code using GetExitCodeProcess(). Sample code is found in
>two MS KB articles:
>
>Q129796, HOWTO: 32-Bit App Can Determine When a Shelled Process Ends
>
>Q178357, HOWTO: Set an Error Level from a Visual Basic Application
>

One thing to watch when doing this.. Using ExitProcess() short
circuits VB cleanup code. Often not a big issue, but make sure you
set all you object references to Nothing, close files, etc. It can be
a big issue with ADO/databases and probably some other resources.


-Tim

0 new messages