Function that informs me when EXE is finished
Posted on 2000-05-03
Hi Experts ;
I have a simple question.
In my Delphi program I run an external EXE File
(With Winexec command) that open a file ("success.doc")
and send data to this File.
After that code I wanna open this File and read the data.
the problem is that I open the file before the EXE finshed sending the
data, and therfor I am getting an eror.
I added a sleep(2000) command between the WinExec command and the openFile
command. This solution is not good enough since I can never be sure
that the milisec I gave to this process is enough, and it changes
from computer to computer. I am looking for a command that let me
run the EXE file and to let me know when it finished to run, only then
I'll open the data File (Success.doc) - I think it should be an API
Here is my code :