Solved

How do I read Dos ErrorLevels from Delphi

Posted on 1997-08-08
5
352 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
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
ygolan earned 200 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now