Solved

Setting the DOS errorlevel in VB5.0

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

729 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