Thema: Spectragram

Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.070 Beiträge
 
Delphi 10.4 Sydney
 
#35

AW: Spectragram

  Alt 22. Sep 2016, 09:50
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!
  Mit Zitat antworten Zitat