Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm building an app which needs display a particular form always on top (this is a customer request), so far I'm using the SetWindowPos function with the HWND_TOPMOST value, and that works fine, but when the Windows 7 Flip 3D feature is activated my app doesn't stay in top.

Windows 7 Flip 3D

enter image description here

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

like image 460
Salvador Avatar asked Feb 06 '12 23:02

Salvador


1 Answers

I do this some time ago using the DwmSetWindowAttribute function modyfing the DWMWA_FLIP3D_POLICY attribute with the DWMFLIP3D_EXCLUDEABOVE value.

Try this code

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;

And this is the result

enter image description here

like image 172
RRUZ Avatar answered Sep 29 '22 11:09

RRUZ