I'm trying to make a window that would display some information when switching from my application to the browser it was running. As a result, at the moment it has been tried:

  • Shape style: fsStayOnTop;
  • Overloading CreateParams with the addition of the WS_EX_TOPMOST style;
  • Call SetWindowPos with the HWND_TOPMOST parameter in OnShow () and by timer;

In any case, Chrome, which is invoked via the ShellExecute () command, overlaps this window ... and other applications too. TopMost only works with other forms of my application.

Perhaps someone has already encountered such behavior and knows how to get around the problem?

PS: Window without frame (BorderStyle = []), Delphi XE2, Windows 10 build 14393;

    1 answer 1

    In general, it turned out that for some reason Delphi removes the flag "on top of all windows" from all its forms when the application is deactivated and sets it again when activated.

    In this regard, the above problem was solved through the Application.OnDeactivate event handler:

    procedure TfmMainForm.appEventsDeactivate(Sender: TObject); begin Application.RestoreTopMosts; end;