Delphi-Quellcode:
program DWM_API_TEST;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Winapi.Windows;
function IsCompositionEnabled: boolean;
var
DwmIsCompositionEnabled:
function(pfEnabled: PBoolean): HRESULT;
stdcall;
hDwmapi: THandle;
Enabled: BOOL;
begin
Result := False;
if (Win32Platform = VER_PLATFORM_WIN32_NT)
and (Win32MajorVersion >= 6)
then
begin
hDwmapi := LoadLibrary('
dwmapi.dll');
if hDwmapi <> 0
then
try
DwmIsCompositionEnabled := GetProcAddress(hDwmapi, '
DwmIsCompositionEnabled');
if Assigned(DwmIsCompositionEnabled)
then
Result := (DwmIsCompositionEnabled(@Enabled) = 0)
and Enabled;
finally
FreeLibrary(hDwmapi);
end;
end;
end;
begin
try
Writeln(IsCompositionEnabled);
Readln;
except
on E:
Exception do
Writeln(E.ClassName, '
: ', E.
Message);
end;
end.
Liefert unter Windows 10 Professional Version 1607 Build 14393.187 ein True zurück.
Geht also!