Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Grok on February 21, 2005, 01:53 PM

Title: Forcing a VB program to return completion code
Post by: Grok on February 21, 2005, 01:53 PM
When calling a typical command-line program written in C, the return value can be handled.  But from VB6 programs, there is no way to set the return value.  Does someone (TheMinistered?) maybe know how to set the return value such that when my program completes, it returns some value I specify in my VB code?
Title: Re: Forcing a VB program to return completion code
Post by: K on February 21, 2005, 02:00 PM
Can you not just use ExitProcess(return_val) when you reach then end of your code?
Title: Re: Forcing a VB program to return completion code
Post by: Newby on February 21, 2005, 02:43 PM
Public Declare Sub ExitProcess Lib "kernel32" Alias "ExitProcess" (ByVal uExitCode As Long)
See if that works.
Title: Re: Forcing a VB program to return completion code
Post by: TheMinistered on February 27, 2005, 09:11 PM
You should use a function to determine if you are in the IDE or not, otherwise you may get unexpected results :) i.e. IDE will close as well :)