Solved

Setting the DOS errorlevel in VB5.0

Posted on 1997-07-29
2
398 Views
Last Modified: 2008-03-17
How can I set the good old DOS errorlevel in Visual
Basic 5.0 when the program exists? I have an existing
application (that I can't change) but can call a VB program, and uses the errorlevel for testing.
0
Comment
Question by:arrow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
cymbolic earned 50 total points
ID: 1429001
You know, you're really in trouble on this one, because you have to communicate between two separate processes and two separate address spaces - you're not in Kansas anymore, Toto!

Here's what I'd do: Modify your VB app to write an error level in a file.  Write another DOS App that shells your VB app, keeps checking for the file, reads the file, and returns a DOS errorlevel to your old DOS app.  Since you run both the old DOS app and the new sheller/errorlevel returner in the same DOS box, they can pass errorlevels between them.  Hey, you can even use a DOS batch process in your DOS box!

If you need any help with this, I have already coded the same thing, once I realized I wasn't in Kansas anymore!
0
 

Expert Comment

by:sbugachevsky
ID: 1429002
You don't have to bother with any flag files.  Here's how you set the errorlevel from a VB program.

Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

public sub main()
    call ExitProcess(_put_your_error_code_here)
end sub


0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question