can somebody explain me how to end a VB6 program and set the value for errorlevel ? this is a value that a program returns when it was called from a DOS prompt.
I want to be able to set this value before exiting my program.
the project consists of 1 module (module1.bas) and no forms.
the name of the project is LOKCHECK. The executable will be LOKCHECK.exe
the module looks like this:
Public a As Integer
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Sub Main()
a = 5
ExitProcess (a)
End Sub
I know this looks stupid and makes no sense. It is only an example to help me to explain to you guys how I do it.
In fact, the exitcode that I want to return will depend on a condition that has nothing to dowith the problem here.
So, what do I do. I compiled a LOKCHECK.EXE. I open DOS box in W2K. I type 'LOKCHECK'. the program executes and returns to the DOs prompt. Then I type 'echo %errorlevel%'
I thought to see 5 as a result but it always shows 0.
Ps: the strange thing is when I'm running this program in the VB6 editor and press the RUN button, not only the program exits but also my VB6 itself also...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.