|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
setting exit code of VB appHello,
My windows app developed in VB has a command line mode. So I expect that other applications will call my app using a shell approach. In the case of command line syntax errors, I want to exit with code that indicates that nature of the error. Is there a way to control the "exit code" the VB application "returns" when it terminates? Perhaps I must make a Win API call? I have perused the VB help files but have not found anything pertinent. tia, MBB MB Blackburn wrote:
> My windows app developed in VB has a command line mode. You'd use the ExitProcess API. Lots of issues there, most of them covered for you by> So I expect that other applications will call my app using a shell > approach. In the case of command line syntax errors, I want to exit > with code that indicates that nature of the error. > Is there a way to control the "exit code" the VB application > "returns" when it terminates? > Perhaps I must make a Win API call? the following two examples: http://vb.mvps.org/samples/Hello http://vb.mvps.org/samples/Console The first is a windowed app, the second (obviously?) purely console (and far more involved). In short, I'd recommend you only call it from a native EXE, not in the IDE or from pcode, and make sure it's the *last* thing you (intended to) do in the app. "Karl E. Peterson" <k***@mvps.org> wrote in message thank you for the quick reply and link to examples.news:e6J$5ZuZFHA.3040@TK2MSFTNGP14.phx.gbl... > You'd use the ExitProcess API. Lots of issues there > ***snip*** > and make sure it's the *last* thing you (intended to) do in the app. i have examined the windows app Hello. IMHO the *last* thing a VB app does is MDIForm_Terminate. so i will calling ExitProcess there...unless advised to do otherwise. thanks again, MBB MB Blackburn wrote:
> "Karl E. Peterson" <k***@mvps.org> wrote in message Can you load/show modally the MDI from Sub Main? I'd really lean that direction.> news:e6J$5ZuZFHA.3040@TK2MSFTNGP14.phx.gbl... > >> You'd use the ExitProcess API. Lots of issues there >> ***snip*** >> and make sure it's the *last* thing you (intended to) do in the app. > > thank you for the quick reply and link to examples. > i have examined the windows app Hello. > > IMHO the *last* thing a VB app does is MDIForm_Terminate. > so i will calling ExitProcess there...unless advised to do otherwise. You could be right, in your specific case, but every app is different. (This is getting way non-standard at this point, of course...) "Karl E. Peterson" <k***@mvps.org> wrote in I don't think he can...news:OmEr9TvZFHA.796@TK2MSFTNGP10.phx.gbl: > Can you load/show modally the MDI from Sub Main? I'd really lean that > direction. You could be right, in your specific case, but every app is > different. (This is getting way non-standard at this point, of > course...) Err.Number: 403 Err.Description: MDI forms cannot be shown modally I would vote against the practice of showing the app main form in sub main modally because it prevents showing other forms modelessly. Ian Ian King wrote:
> "Karl E. Peterson" <k***@mvps.org> wrote in Yeah, that rings a bell.> news:OmEr9TvZFHA.796@TK2MSFTNGP10.phx.gbl: > >> Can you load/show modally the MDI from Sub Main? I'd really lean >> that direction. You could be right, in your specific case, but every >> app is different. (This is getting way non-standard at this point, >> of course...) > > I don't think he can... > > Err.Number: 403 > Err.Description: MDI forms cannot be shown modally > I would vote against the practice of showing the app main form in sub I'd tend to vote against returning a result code from a windowed application, myself.> main modally because it prevents showing other forms modelessly. Just doesn't seem right. |
|||||||||||||||||||||||