Glaube ich eigentlich* nicht.
*ich wüsste dicht das man da etwas syncron. müsste.
Es kann aber auch an der Umsetzung des Quelltextes von C nach Delphi liegen...
Delphi-Quellcode:
implementation
{$R *.dfm}
// DWMFLIP3DWINDOWPOLICY
const
DWMFLIP3D_DEFAULT = 0;
DWMFLIP3D_EXCLUDEBELOW = 1;
DWMFLIP3D_EXCLUDEABOVE = 2;
type
DWMFLIP3DWINDOWPOLICY = DWMFLIP3D_DEFAULT..DWMFLIP3D_EXCLUDEABOVE;
// DWMNCRENDERINGPOLICY
const
DWMNCRP_USEWINDOWSTYLE = 0;
DWMNCRP_DISABLED = 1;
DWMNCRP_ENABLED = 2;
DWMNCRP_LAST = 3;
type
TDWMNCRENDERINGPOLICY = DWMNCRP_USEWINDOWSTYLE..DWMNCRP_LAST;
PDWMNCRENDERINGPOLICY = ^TDWMNCRENDERINGPOLICY;
// DWMWINDOWATTRIBUTE
const
DWMWA_NCRENDERING_ENABLED = 1;
DWMWA_NCRENDERING_POLICY = 2;
DWMWA_TRANSITIONS_FORCEDISABLED = 3;
DWMWA_ALLOW_NCPAINT = 4;
DWMWA_CAPTION_BUTTON_BOUNDS = 5;
DWMWA_NONCLIENT_RTL_LAYOUT = 6;
DWMWA_FORCE_ICONIC_REPRESENTATION = 7;
DWMWA_FLIP3D_POLICY = 8;
DWMWA_EXTENDED_FRAME_BOUNDS = 9;
DWMWA_LAST = 10;
type
TDWMWINDOWATTRIBUTE = DWMWA_NCRENDERING_ENABLED..DWMWA_LAST;
var
hDWMDLL: THAndle;
DwmSetWindowAttribute: function(WindowHandle: HWND; dwAttribute: DWORD;
pvAttribute: Pointer; cbAttribute: DWORD): HRESULT; stdcall;
function DisableNCRendering(WindowHandle: HWND): BOOL;
var
hr: HRESULT;
ncrp: TDWMNCRENDERINGPOLICY;
begin
Result := FALSE;
if @DwmSetWindowAttribute <> nil then
begin
ncrp := DWMNCRP_ENABLED;
//disable non-client area rendering on window
hr := DwmSetWindowAttribute(WindowHandle, DWMWA_NCRENDERING_POLICY, @ncrp, sizeof(ncrp));
Result := Bool( hr = S_OK );
end;
end;
function DisableFlip3D(WindowHandle: HWND): BOOL;
var
hr: HRESULT;
flip: TDWMNCRENDERINGPOLICY;
begin
Result := FALSE;
if @DwmSetWindowAttribute <> nil then
begin
flip := DWMFLIP3D_EXCLUDEBELOW;
//disable non-client area rendering on window
hr := DwmSetWindowAttribute(WindowHandle, DWMWA_FLIP3D_POLICY, @flip, sizeof(flip));
Result := Bool( hr = S_OK );
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
hDWMDLL := LoadLibrary('DWMAPI.DLL');
if hDWMDLL <> 0 then
begin
@DwmSetWindowAttribute := GetProcAddress(hDWMDLL, 'DwmSetWindowAttribute');
if not DisableNCRendering(Self.Handle) // das FormX.Handle
then ShowMessage('DwmSetWindowAttribute konnte ggf. das Attribut nicht setzen.');
// oder: DisableFlip3D(Self.Handle);
end;
if hDWMDLL <> 0 then FreeLibrary(hDWMDLL);
end;
end.