Terminating a child process - Win32 in Delphi
Posted on 2004-04-29
I have spawned a child process using CreateProcess and want to
terminate it politely i.e. not by using TerminateProcess which is
draconian. I had thought of sending a WM_CLOSE message. However, the
handle to the process (from ProcessInfo.hProcess) is not the same as
the app handle I need nor the handle of the spawned app's main form.
Does anybody know either
a) how I can get the appropriate handle
b) a better way of politely terminating the process than sending a
The precise executable spawned is not known at designtime so I can't
look for the window by name.