How do I read Dos ErrorLevels from Delphi

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??
LVL 3
jdthedjAsked:
Who is Participating?
 
ygolanConnect With a Mentor Commented:
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
 
jdthedjAuthor Commented:
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
 
ygolanCommented:
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
 
jdthedjAuthor Commented:
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
 
ygolanCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.