procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); begin PostMessage(Application.Handle, WM_QUIT, 0, 0); end;