Re: If you were inventing CoBOL...
From: Robert Wagner (robert_at_wagner.net.yourmammaharvests)
Date: 09/18/04
- Next message: James J. Gavan: "Re: If you were inventing CoBOL..."
- Previous message: Robert Wagner: "Re: If you were inventing CoBOL..."
- In reply to: Rick Smith: "Re: If you were inventing CoBOL..."
- Next in thread: Rick Smith: "Re: If you were inventing CoBOL..."
- Reply: Rick Smith: "Re: If you were inventing CoBOL..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 18 Sep 2004 17:58:55 GMT
On Sat, 18 Sep 2004 11:41:49 -0400, "Rick Smith" <ricksmith@mfi.net>
wrote:
>"Robert Wagner" <robert@wagner.net.yourmammaharvests> wrote in message
>news:ga8nk0tgaon5kcek3425uk5m713m58ugfh@4ax.com...
>> Returning an exit status is so basic, I can't believe it wasn't
>> addressed before 2002.
>
>It was addressed before 2002, by applications programmers
>using whatever means was at their disposal.
>
>Consider the effect of 'returning an exit status' to MS-DOS
>or Windows. It's meaningless!
13.3.7.1 Terminate Program Execution
---------- MS-DOS ---------------------------------------------------
Function (ah): 4Ch
Entry parameters: al- return code
Exit parameters: Does not return to your program
This is the function call normally used to terminate your program. It
returns control to the calling process (normally, but not necessarily,
DOS). A return code can be passed to the calling process in the al
register. Exactly what meaning this return code has is entirely up to
you. This return code can be tested with the DOS "IF ERRORLEVEL return
code" command in a DOS batch file. All files opened by the current
process will be automatically closed upon program termination.
--------- MS-DOS ---------------------------------------------------
Return a Dos error code on exit
At times you may want to return a Dos ErrorLevel when closing your VB
application. This can be necessary, for example, if the EXE is meant
to be called from a batch file. Exiting the program with an error code
is really simple, and requires only a call to the ExitProcess API
function:
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As
Long)
' Exit with ErrorLevel set to 9
ExitProcess 9
The following Ms-Dos batch error runs the Text.Exe application, and
then tests whether its error level is 2, 1, or zero. Note that exit
codes must be tested in reverse order, from the highest value downward
REM a Ms-Dos batch file
CD c:\MyApp
Text.Exe
If Errorlevel 2 Goto ExitCodeIsTwo
If Errorlevel 1 Goto ExitCodeIsOne
REM process here a null exit code
REM ...
GOTO EndBatch
:ExitCodeTwo
REM process here exit code equals to two
REM ...
GOTO EndBatch
:ExitCodeOne
REM process here exit code equals to one
REM ...
:EndBatch
ECHO goodbye.
--------- Windows ---------------------------------------------------
ExitProcess
The ExitProcess function ends a process and all its threads.
VOID ExitProcess(
UINT uExitCode
);
Parameters
uExitCode
[in] Exit code for the process and all threads terminated as a result
of this call. Use the GetExitCodeProcess function to retrieve the
process's exit value. Use the GetExitCodeThread function to retrieve a
thread's exit value.
------- Scripting Languages ------------------------------------------
Windows Script Host
ExitCode Property
Returns the exit code set by a script or program run using the Exec()
method.
Executables set an exit code when they finish running. This conveys
the status information when a process ends. Often, it is used to send
an error code (or some other piece of information) back to the caller.
If the process has not finished, the ExitCode property returns 0. The
values returned from ExitCode depend on the application that was
called
- Next message: James J. Gavan: "Re: If you were inventing CoBOL..."
- Previous message: Robert Wagner: "Re: If you were inventing CoBOL..."
- In reply to: Rick Smith: "Re: If you were inventing CoBOL..."
- Next in thread: Rick Smith: "Re: If you were inventing CoBOL..."
- Reply: Rick Smith: "Re: If you were inventing CoBOL..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|