简体   繁体   中英

DwmEnableComposition not enabling Aero

I'm trying to enable Aero for my application (a Firefox plugin running "single process" with the browser) but I'm failing to do so. The OS is Windows 7 64bit.

This is the code:

BOOL bEnabled = FALSE;
if(SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && !bEnabled){         
    HRESULT hres = DwmEnableComposition(DWM_EC_ENABLECOMPOSITION);
}

DwmEnableComposition should enable composition but it doesn't, also the function returns:

S_OK

Any help would be appreciated,thanks!

You cannot enable DWM composition; you can only request that it be disabled. When you're done needing it to be off, you call

DwmEnableComposition(DWM_EC_ENABLECOMPOSITION);

From MSDN:

DWM composition will be automatically enabled when all processes that have disabled composition have called DwmEnableComposition to enable it or have been terminated.

You don't get to enable it, you only to announce that you no longer need it disabled. (The reason Microsoft doesn't let you enable composition is that you can't be trusted to not try to do it. )

You should also give up while you're behind. Again from MSDN:

Note This function is deprecated as of Windows 8 Consumer Preview. DWM can no longer be programmatically disabled.

DwmEnableComposition() has no effect when it is disabled system wide. It's sole purpose is to notify Windows that you're starting or finishing an operation that is incompatible with DWM.

Furthermore, it's up to the user what their OS looks like, it's not up to a program to configure it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM