Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Setting the DOS errorlevel in VB5.0

Posted on 1997-07-29
2
Medium Priority
?
416 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 200 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 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