procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);begin //Какой то код Action:=caFree;end;