Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to "kill" a program 1

Status
Not open for further replies.

svanels

MIS
Aug 18, 1999
1,393
SR
Enough being said about how to launch a program from a delphi application.
What about, terminating a program and doing the necessary clean-up (the program doesn't receive control).

Regards

Steven
 
If you refer to: "kill an external process",
here you can found solution:


if you refer to: "close all forms of your application":

For an SDI applications:

Code:
for i := application.ComponentCount - 1 downto 0 do
begin
if application.components[i] is TForm then
(application.components[i] as TForm).close;
end;

For an MDI application:

Code:
for i := MainForm.MDIChildCount - 1 downto 0 do
MainForm.MDIChildren[i].close;

You can close your application with 'Application.Terminate' but, from Delphi Help:

"If the application itself terminates (for example, by calling the Terminate method of the Application object), all forms close without receiving an OnClose event."

Hope this help you
Giovanni Caramia
 
Thanks Giovanni! It is 'kill an external process', the link did it.

Steven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top