Ok, here it comes:
let's keep it simple:
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...