Maximiliano Santa Cruz
Maximiliano Santa Cruz

Reputation: 401

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!

Upvotes: 2

Views: 2601

Answers (2)

Ian Boyd
Ian Boyd

Reputation: 256911

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.

Upvotes: 3

Deanna
Deanna

Reputation: 24283

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.

Upvotes: 1

Related Questions