how to determine if a shelled process has terminated ?
Posted on 1998-07-30
with the help of Delphi 3.0, I would like to start an external program several times.
It is very important for me that this *.exe is launched a second time not before the first process is terminated. In other words: The *.exe should BY NO MEANS be launched
simultanously,but consecutively. How can I find out, if a shelled process is already
In Visual Basic, I would do it like this:
Private Sub btnEndCommand_Click()
For i = 0 To File1.ListCount - 1
If File1.Selected(i) = True Then
If Right$(Dir1.path, 1) = "\" Then
Parameter = Dir1.path + File1.filename
Parameter = Dir1.path + "\" + File1.filename
X% = Shell("E:\MYPROGRAM.EXE " + Parameter, 4)
' Modify the path as necessary.
While GetModuleUsage(X%) > 0
' Has Shelled program finished?
z% = DoEvents() ' If not, yield to Windows.
MsgBox "Shelled application just terminated", 64
How can this be done with Delphi 3.0 ?
With kind regards