I tried:
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
begin
if Key = vkHardwareBack then begin
Key := 0;
Form1.WindowState := TWindowState.wsMinimized; // Also tried Application.MainForm
end;
end;
But when you hit the first time the screen gets black, when you hit the second time the app closes. How to avoid this?