Board index » delphi » Help: Close apps from Delphi

Help: Close apps from Delphi

How do I close a Windows application which was executed by Delphi
application using the WinExec command?
 

Re:Help: Close apps from Delphi


Quote
Chi Tsi wrote:

> How do I close a Windows application which was executed by Delphi
> application using the WinExec command?

You use FindWindow, and search for the window caption of the program,
pass a PChar(0) for the class. Then you send a WM_SYSCOMMAND (I think
that was the message name) to the window with SC_CLOSE (again, think
so),lParam can be 0. You may not be able to do it right after WinExec
without giving Windows a chance to process messages, or the other
program to finish it's task.

--
Bent Tranberg, Agder College, Grimstad
Grooseveien 36, 4890 Grimstad, Norway
e-mail: Bent.Tranb...@hia.no Web: http://www.hia.no

Other Threads