AK> Hello All!
AK> How can I get exit code of DOS-process that have been run using
AK> WinExec?
AK> Greetings, Alexander
Alexander,
WinExec doesn't support this feature.
I don't recall if any of the API calls that will shell a DOS program support
this or not but I tend to doubt it. In anycase, I can suggest a simple but
kludgy way to do it...since having a windows program shell a DOS program is
somewhat kludgy anyway, you shouldn't mind . Anyway, here is what I would
suggest.
Write either a batch file or EXE that will call the program. Let that the
batch file or program capture the return code, write it to a file and then
exit. Your program can inspect the file and then delete it.
i.e.
MYBATCH.BAT
@echo off
REM Run MYPROG.EXE and get Errorcode
MYPROG
IF ERRORLEVEL 1 Then echo 1 > ERROR.DAT
IF ERRORLEVEL 0 Then echo 0 > ERROR.DAT
So, your program just call's the batch or program that does the work and
let's it execute the program.
If you wan't to get real sneaky, so there is no evidence that your program
uses a batch file and to eliminate the need to worry about shipping the file
with your app or having it not find it, you can make your program create the
batch file before it makes the call or during start up so it is always there
and ready to go.
Hope this helps.
Steve
--- FreeMail 1.07b
(1:203/21)
---------------
* Origin: The Visual Programmer's Workshop - N.H., Ca (916)338-3230 *
|