Disable the aero fade-in effect on the dialog

I have a modal dialog that I create using MFC. When it appears, the Aero theme makes a transition to a gradual transition mode for a new window to appear. In my particular case, I switch immediately from one dialogue to another, and the fading effect is distracting. Is there a way in which it can be turned off, so the window immediately appears, like when you turned off Aero, but without completely turning off Aero?

+4
source share
1 answer

The DwmSetWindowAttribute function can help you. It allows you to change several window attributes associated with DWM. In particular, the DWMWA_TRANSITIONS_FORCEDISABLED attribute mentions β€œEnable or DWMWA_TRANSITIONS_FORCEDISABLED Disable DWM Transitions,” which might just do the trick.

 HRESULT hr = S_OK; LPCVOID dwAttribute = (LPCVOID)TRUE; hr = DwmSetWindowAttribute(hWnd, DWMWA_TRANSITIONS_FORCEDISABLED, &dwAttribute, sizeof(dwAttribute)); if (SUCCEEDED(hr)) { // The transitions should have been disabled } 
+4
source

All Articles