
Return an exit-code from a running VB 6 application
I'm programing a
Visual Basic 6 application under Windows 95 for target
system Windows NT.
My application will be started by another process (parrent process)
which waits until my application ends.
My application should return an exit code to its parent process for
error indication, f.e. 1 if an error occured and 0 if no error happened.
How can i program this functionality of returning an errorcode or in
general an exit code in VB 6.
I tried to do that:
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Private Sub Form_Terminate()
ExitProcess 3&
End Sub
but my batch-File which starts my VB6 test.exe application under Windows
95
echo off
start /w test.exe
if errorlevel 0 goto 100
if errorlevel 1 goto 200
goto Done
:100
echo Exit Code 0
goto done
:200
echo Exit Code 1
goto done
:done
echo done
shows my always "Exit Code 0".