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).
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."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.