尝试使用以下代码来检查 Windows Aero 是否已启用:
function AeroEnabled: boolean;
var
enabled: bool;
begin
// Function from the JwaDwmapi unit (JEDI Windows Api Library)
DwmIsCompositionEnabled(enabled);
Result := enabled;
end;
...
if (CheckWin32Version(5,4)) and (AeroEnabled) then
CampaignTabs.ColorBackground := clBlack
else begin
GlassFrame.Enabled := False;
CampaignTabs.ColorBackground := clWhite;
end;
Run Code Online (Sandbox Code Playgroud)
但是,在 Vista 之前的计算机上执行此操作会导致应用程序崩溃,因为缺少 DWMApi.dll。我也尝试过这段代码,但是它连续生成 2 个 AV。我怎样才能做到这一点 ?我正在使用 Delphi 2010。:)