title: Close applications safely from a service
body: <p>I have 2 programs in Delphi - a service and some child processes that may run in any user session (these start when the service starts and should be closed when the service stops).</p>
  
  <p>When the service stops I have to close the child applications safely, to make them catch formClose/FormDestroy events.</p>
  
  <p>The service cannot use desktop communication, so it cannot send WMs like WM_Close, etc., to those processes.</p>
  
  <p>Calling TerminateProcess does not make formClose/FormDestroy events occur in my child processes ...</p>
  
  <p>So, what method of child process termination may be used here?</p>
  
  <p>Currently, the only idea we have is to run taskkill.exe /im process.exe in each user session - it somehow makes killed process to run formClose/FormDestroy.  How does it work? Just by sending WM_CLOSE?</p>