Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
How to return exit code from VB6 form?
Question
Sunday, October 5, 2014 8:52 AM
It's a simple question, I had tried not to ask this question by searching msdn to see if there's something i can get...
but due to time constraint to complete my project, can anyone help me to advise how to return exit code from Vb6 form?
the vb6 form will be called by other application. when Vb6 form is called, the application need to know whether if the vb6 can run successfully through exit code.
Jason
All replies (4)
Sunday, October 5, 2014 9:16 AM ✅Answered | 1 vote
You can use this:
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
ExitProcess 1
This will return with errorcode 1
"If there's nothing wrong with me, maybe there's something wrong with the universe!"
Sunday, October 5, 2014 6:41 PM
Seems that exit codes are not fully supported by VB6 and the recommendation is to use an intermediate output file or other communication techniques: http://support2.microsoft.com/default.aspx?kbid=288216.
Monday, October 6, 2014 12:25 AM
How to validate if the exit code was returned correctly?
Jason
Monday, October 6, 2014 4:01 AM
This is a scripting question. If you're using common batch files you should check like this:
@echo off
myprogram.exe
IF ERRORLEVEL 10 GOTO PROBLEM_10
IF ERRORLEVEL 9 GOTO PROBLEM_9
.....
IF ERRORLEVEL 1 GOTO PROBLEM_1
GOTO ALL_OK
:PROBLEM_10
ECHO ....
GOTO BAD_EXIT
:PROBLEM_9
ECHO ....
GOTO BAD_EXIT
:BAD_EXIT
ECHO ....
GOTO END
:ALL_OK
ECHO ....
:END
"If there's nothing wrong with me, maybe there's something wrong with the universe!"
