Solved

How do I read Dos ErrorLevels from Delphi

Posted on 1997-08-08
5
359 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 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

Technology Partners: 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

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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