I found a workaround for this.
When you create a form with the owner, FireMonkey should pass the owner down to the Windows CreateWindowEx , but that is not the case.
In the FMX.Platform.Win module in the CreateWindow() function, change this:
Wnd := CreateWindowEx(ExStyle, WindowClass.lpszClassName, PChar(AForm.Caption), Style, Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), GetDesktopWindow, 0, hInstance, nil);
For this:
// If there an owner, and it a form, then create the window as a child if (AForm <> nil) and (AForm.Owner <> nil) and (AForm.Owner is TForm) then begin // Child window Wnd := CreateWindowEx(ExStyle, WindowClass.lpszClassName, PChar(AForm.Caption), Style, Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), HandleToHWND(TForm(AForm.Owner).Handle), 0, hInstance, nil); end else begin // Desktop window Wnd := CreateWindowEx(ExStyle, WindowClass.lpszClassName, PChar(AForm.Caption), Style, Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), GetDesktopWindow, 0, hInstance, nil); end;
So, if you are going to create a child, especially a modal form, be sure to designate the parent form as the owner when you create it as follows:
MyModalForm := TMyModalForm.Create(MyParentForm); MyModalForm.ShowModal;
Then everything will work as expected after the fix.
Do not forget to remove the child form from the list of Forms of automatic creation in the settings of your project.