Try Application.Restore or Application.RestoreTopMosts . And when this modal dialog is shown by calling WinAPI, try Application.Normalize(All)TopMosts before.
Now this may be enough, but in my application, which hides the application descriptor from the taskbar, it is not, and I need the following procedure, which is the TApplicationEvents.OnActivate event TApplicationEvents.OnActivate :
procedure TMainForm.AppEventsActivate(Sender: TObject); var TopWindow: HWND; begin TopWindow := GetLastActivePopup(Application.Handle); if (TopWindow <> 0) and (TopWindow <> Application.Handle) then begin BringToFront; SetForegroundWindow(TopWindow); end; end;
Clarification: the code in Application.BringToFront almost the same, but it does not guarantee that the main form is displayed in the background either. That is, Application.BringToFront can only show a modal dialog box.
source share