How to make a form always on top, even if Windows 7 Flip 3D is activated

I am creating an application for which it is always necessary to display a specific form (this is a client request), so far I am using SetWindowPos with a value of HWND_TOPMOST, and this works fine, but when the Windows 7 Flip 3D function is activated, my application does not stay at the top.

Windows 7 Flip 3D

enter image description here

The question is, how can my form stay on top of all the other windows, even if Windows 7 Flip 3D is activated?

+5
source share
1 answer

I do this a while ago using a function DwmSetWindowAttributeby changing DWMWA_FLIP3D_POLICY with the value DWMFLIP3D_EXCLUDEABOVE .

uses
  Winapi.DwmApi;

procedure TForm40.FormCreate(Sender: TObject);
var
  pvAttribute: Integer;
begin
  pvAttribute:= DWMFLIP3D_EXCLUDEABOVE;
  if DwmCompositionEnabled then
   DwmSetWindowAttribute(Handle, DWMWA_FLIP3D_POLICY, @pvAttribute, Sizeof(Integer));
end;

enter image description here

+19

All Articles