procedure TForm1.ApplicationEventsMainDeactivate(Sender: TObject); begin SetForegroundWindow(GetActiveWindow); end;