FindWindow and WM_CLOSE can do it.

var
  hnd: HWnd;
begin
  hnd := FindWindow(nil, 'MainFormsCaption');
  if hnd <> 0 then
    PostMessage(hnd, WM_CLOSE, 0, 0);
end;


On Sat, Mar 19, 2011 at 11:01 AM, SoftTech <mi...@softtechks.com> wrote:

> Greetings All,
>
> In certain instances I start a secondary tray application from my main
> application.
>
> When I close my main application, I would like to close my secondary tray
> application as well if it is still in the tray.
>
> Any ideas on how to do this?
>
> Thanks to all who reply,
> Mike
> __________________________________________________
> Delphi-Talk mailing list -> Delphi-Talk@elists.org
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
>
__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to