Disable aero fade-in effect on dialog

前端 未结 1 1255
孤街浪徒
孤街浪徒 2020-12-21 04:42

I have a modal dialog I\'m creating with MFC. When it appears, the Aero theme does it\'s fade-in transition for a new window appearing. In my particular case I\'m switchin

相关标签:
1条回答
  • 2020-12-21 05:01

    The DwmSetWindowAttribute function might be able to help you. It lets you modify a number of window attributes related to the DWM. In particular, the DWMWA_TRANSITIONS_FORCEDISABLED attribute mentions "Enable or forcibly disable DWM transitions", which just might 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
    }
    
    0 讨论(0)
提交回复
热议问题