Waiting for a DOS application to terminate?
Hello.
I want to write a windows frontend for a DOS tool.
So I call the DOS app and the DOS box pops up.
Then I have to wait until it has finished
before I can proceed. But how do I know?
I tried to use FindWindow() and look periodically
for a window title with my DOS application name.
But that is e.g. different in WinNT as in Win98.
Any solutions?
BR,
DÃ*etmar
Re: Waiting for a DOS application to terminate?
Hi,
Use OpenProcess to get a handle to the process.
(Or use CreateProcess to create the process and to obtain the process handle)
Then use WaitForSingleObject to wait for its termination.
Bye
Peter
Re: Waiting for a DOS application to terminate?
Do you mean this?
WaitForSingleObject
(hHandle, // = hProcess from struct PROCESS_INFORMATION
timeout);
In Win98 the DOS box is still visible after termination.
Does this work anyway?
Re: Waiting for a DOS application to terminate?
Hi,
yes, it's the hProcess member of the PROCESS_INFORMATION structure.
I don't know what happens when the dos-box keeps visible. Try following:
STARTUPINFO's dwFlags contains STARTF_USESHOWWINDOW
STARTUPINFO's wShowWindow is SW_HIDE
Bye
Peter