Solved

Setting the DOS errorlevel in VB5.0

Posted on 1997-07-29
2
384 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
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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