?
Solved

How do I read Dos ErrorLevels from Delphi

Posted on 1997-08-08
5
Medium Priority
?
374 Views
Last Modified: 2010-04-04
My App calls a legacy DOS program which sometimes produces an error.  I need to trap the ErrorLevel from DOS when control is returned to my prog so I can advise the user to take the appropriate action.

How do I read the ErrorLevel??
0
Comment
Question by:jdthedj
[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
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
ygolan earned 800 total points
ID: 1340872
Use CreateProcess to run the application.Use the process handle returned in the lpProcessInformation record to WaitForSingleObject, then use it with GetExitCodeProcess.

Here  is the pseudo code :

CreateProcess(...., ProcessInformat);
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
GetExitCodeProcess(ProcessInformation.hProcess, ExitCode);
0
 
LVL 3

Author Comment

by:jdthedj
ID: 1340873
I am using D1 and I have looked in Delphi help and WinApi help but cannot find reference to the commands mentioned in the answer.  Is there a different method using D1??
0
 
LVL 1

Expert Comment

by:ygolan
ID: 1340874
With D1 it is a lot more complicated...

Tell you what - raise the points to 300 and give me your email address, and I'll email you XSpawn - it's a product we used to sell that solves this problem for D1, but we no longer sell it (do not wish to provide technical support for it anymore...)
0
 
LVL 3

Author Comment

by:jdthedj
ID: 1340875
I'd love to raise the points to 300, but I am new to this and only have 205 available.  If you're feeling generous my email address is johnd@caverock.co.nz.  Maybe I can make it up later??
0
 
LVL 1

Expert Comment

by:ygolan
ID: 1340876
Should be in your mail box any minute now...

As for the points, don't worry about them, no need to make it up.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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