【发布时间】:2015-12-19 17:47:24
【问题描述】:
我有一个更新的代码,可以很好地在 Windows Vista 和 Windows 7 中启用或禁用 AERO 组合。但是在 Windows 8 系统中使用相同的代码时,它不起作用。我在other website 中看到,从 Windows 8 开始,AERO 组合无法再以编程方式禁用。那么,想知道这里是否有人在 Windows 8 系统或更高版本中使用 Delphi 中的某些功能或程序来实现此目标吗?
欢迎提出任何建议。
这是我在 Windows Vista 和 Windows 7 中启用或禁用 AERO 组合的代码:
function ISAeroEnabled: boolean;
type
_DwmIsCompositionEnabledFunc = function(var IsEnabled: boolean)
: HRESULT; stdcall;
var
Flag: boolean;
DllHandle: thandle;
OsVersion: TOSVersionInfo;
DwmIsCompositionEnabledFunc: _DwmIsCompositionEnabledFunc;
begin
Result := false;
ZeroMemory(@OsVersion, Sizeof(OsVersion));
OsVersion.dwOSVersionInfoSize := Sizeof(TOSVersionInfo);
if ((GetVersionEx(OsVersion)) and
(OsVersion.dwPlatformId = VER_PLATFORM_WIN32_NT) and
(OsVersion.dwMajorVersion >= 6)) then
begin
DllHandle := LoadLibrary('dwmapi.dll');
try
if DllHandle <> 0 then
begin
@DwmIsCompositionEnabledFunc := GetProcAddress(DllHandle,
'DwmIsCompositionEnabled');
if (@DwmIsCompositionEnabledFunc <> nil) then
begin
if DwmIsCompositionEnabledFunc(Flag) = S_OK then
Result := Flag;
end;
end;
finally
if DllHandle <> 0 then
FreeLibrary(DllHandle);
end;
end;
end;
procedure AeroSetEnable(enable: boolean);
const
DWM_EC_DISABLECOMPOSITION = 0;
DWM_EC_ENABLECOMPOSITION = 1;
var
DWMlibrary: THandle;
begin
DWMlibrary:= LoadLibrary('DWMAPI.dll');
if DWMlibrary <> 0 then
begin
if @DwmEnableComposition <> nil then
begin
if enable then begin
if not ISAeroEnabled then
begin
DwmEnableComposition(DWM_EC_ENABLECOMPOSITION)
end;
end
else begin DwmEnableComposition(DWM_EC_DISABLECOMPOSITION); end;
end;
end;
end;
【问题讨论】:
-
如果您说明了为什么它对您很重要,这个问题会更有用。例如,为什么您的应用程序需要禁用 Aero。这一切都是为了避免修复其他一些故障吗?您的应用程序是 DPI 虚拟化的,还是 DPI 感知的。您使用的是什么版本的 Delphi,是否有自定义清单?
-
我使用远程协助,当我在我的客户的电脑上工作时,我启动了一个“表单拦截器”(带有
AlphaBlend:= True),里面有一些动画(比如“加载图像”例如),以防止在我工作时与您的计算机进行任何用户交互。而且我没有使用任何清单.. -
为什么在 aero 开启时 alpha 混合不起作用?
标签: delphi aero aero-glass