How: end code (something like exit code in C) 
Author Message
 How: end code (something like exit code in C)

I run an VB 5.0 exe under NT 4.0. I start this exe in a batch file from an
MS_DOS Window.
Is it possible to give an code to the end command so the code is passed to
the batch file? Or is there an other way to pass the end code to the caller
of my exe?

I want to stop my VB app if there is an special error code and call it
again from the start.bat file, when the app returned me that it was not an
normal shut down. So I had to pass 2 different values to start.bat, when
the VB app is ended.

Any help wellcome.

Roman

---

Remove NOSPAM from my mail address.(It is inserted to avoid spam mail)
Flowers are the smile of nature. We can do without them, but not as
well.                                                 (Maximilian Kolbe)



Fri, 01 Sep 2000 03:00:00 GMT  
 How: end code (something like exit code in C)


Schwartz) schreibt:

Quote:
>Is it possible to give an code to the end command so the code is passed to
>the batch file?

Windows usually discards any returned exit status from Windows applications.
Therefore I doubt that _any_ Windows exe could return an exit status. Perhaps
console applications can do so, but not VB apps.

DoDi

Vielleicht am besten das Ergebnis in eine Datei schreiben, und von einem
DOS-Programm lesen lassen, oder gleich die passende BAT-Datei erzeugen und
nachher ausfhren. Rckgabewerte von Windows-Programmen sind bis Win3.11 immer
weggeworfen worden, das drfte bei neueren Versionen und auch bei NT nicht
anders sein.



Sat, 02 Sep 2000 03:00:00 GMT  
 How: end code (something like exit code in C)

How about creating a specific "temp file" when the program opens and
then deleting it when the program closes (whithout an error).

In the batch file you could check for the existance of the file and if
it is found then you know that you did not end the original program
errorlessly?

Kind of clunky but it should work.  It will keep the files "clean" if
everything goes correct.

HTH,

Barry


Quote:

>Schwartz) schreibt:

>>Is it possible to give an code to the end command so the code is passed to
>>the batch file?

>Windows usually discards any returned exit status from Windows applications.
>Therefore I doubt that _any_ Windows exe could return an exit status. Perhaps
>console applications can do so, but not VB apps.

>DoDi

>Vielleicht am besten das Ergebnis in eine Datei schreiben, und von einem
>DOS-Programm lesen lassen, oder gleich die passende BAT-Datei erzeugen und
>nachher ausfhren. Rckgabewerte von Windows-Programmen sind bis Win3.11 immer
>weggeworfen worden, das drfte bei neueren Versionen und auch bei NT nicht
>anders sein.

Barry Eggers
eggers1 AT tsil DOT net


Sat, 02 Sep 2000 03:00:00 GMT  
 How: end code (something like exit code in C)

If you started a process with CreateProcess, you can easily get the return code
with an API called something like GetExitCodeProcess.

I *think* there is an API like SetExitCode which a VB program could call.
Sorry, but you'll have to look up MSDN.

Mar



Sun, 03 Sep 2000 03:00:00 GMT  
 How: end code (something like exit code in C)

I know that start /w under Windows 95 is documented to retrieve the exit code
of the program it is waiting on.  The NT version of Start is not the same, but
probably has the same feature, somehow.

However, the boring answer most people give is: write or create a file and use
FIND or IF EXIST in the batch file.

As I said in my other post, I'm pretty sure there is an API SetExitCode or
something like it.  Look up MSDN, or the source of the C runtime library :-)

Mark



Sun, 03 Sep 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How do I code a menu Exit to exit

2. Can VB return exit code on program termination as exit(X) in C

3. Something missing from code?

4. is there something wrong with my code?

5. need code,DLL or something to play MP3's

6. Execute Code on Application Exit?

7. HELP !!!!! How to create exit Code

8. Code to Exit Outlook

9. Help with cell exit code

10. Problm while running the Project: The program has exited with code 0

11. vb_dotnet thread: Problems with VB.NET : The program has exited with code 0

12. get exit code of a process object

 

 
Powered by phpBB® Forum Software