Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Bug within the theming code in combination with Vista DWM changes Collapse All
Subject Author Date
Gregor Jasny Oct 24, 2007 - 3:54 AM

Hi,

In our application we need to temporarily disable the Vista Composition Manager. Therefore we call
g_PaintManager.m_DWM.DwmEnableComposition(FALSE). But after disabling or re-enabling composition mode
the window borders of our app are looking strange. After re-enabling transparency the window border stays gray
instead of becoming transparent. The toolbars and menubars seems to be too short on their right side, too.
Sometimes the complete titlebar is missing.

Steps to reproduce:
1. Create a Dialog or SDI (they break differently) based application with the Prof-UIs Wizard.
2. Place two buttons or menu entries and create event handlers
3. In the event handlers call
g_PaintManager.m_DWM.DwmEnableComposition(FALSE);
or
g_PaintManager.m_DWM.DwmEnableComposition(TRUE);
4. Enable Composition Manager (aka Vista Aero Style) via the Control Panel
5. Start the app
6. Disable Composition (DwmEnableComposition(FALSE))
7. Enable Composition (DwmEnableComposition(TRUE))

Watch the breakage in steps 6 and 7.

Note: When toggling composition via the Control Panel everything works like a charm.

Environment:
* Windows Vista Ultimate 32bit (with latest Patches)
* ProfUIs 2.81 commercial
* Visual Studio 2005 SP1 & Vista SP1
* Debug, MBCS configuration

If you need further information or some screenshots please contact me.

Thanks,
Gregor

Technical Support Oct 29, 2007 - 12:18 PM

Thank you for reporting this bug. To fix it, please add the code for handling the WM_DWMCOMPOSITIONCHANGED message in the CExtNcFrameImpl::NcFrameImpl_PostWindowProc() method:

void CExtNcFrameImpl::NcFrameImpl_PostWindowProc( LRESULT & lResult, UINT message, WPARAM wParam, LPARAM lParam )
{
      lResult;
      switch( message )
      {

/// BEGIN: new code //////////////////////////////////////////////////////////

      case 0x031E: // WM_DWMCOMPOSITIONCHANGED
            {
                  CExtPaintManager * pPM = NcFrameImpl_GetPM();
                  ASSERT_VALID( pPM );
                  m_BridgeNC.PmBridge_OnPaintManagerChanged( pPM );
                  CWnd * pWndFrameImpl = NcFrameImpl_GetFrameWindow();
                  if( pWndFrameImpl->GetSafeHwnd() != NULL )
                  {
                        if( pWndFrameImpl->IsKindOf( RUNTIME_CLASS(CFrameWnd) ) )
                              ((CFrameWnd*)pWndFrameImpl)->RecalcLayout();
                        BOOL bDwmIsCompositionEnabled = FALSE;
                        if(         m_pNcFrameImplBridge != NULL
                              &&    m_pNcFrameImplBridge->NcFrameImplBridge_GetSafeHwnd() != NULL
                              &&    ( ! pWndFrameImpl->IsZoomed() )
                              &&    g_PaintManager.m_DWM.DwmIsCompositionEnabled( & bDwmIsCompositionEnabled ) == S_OK
                              &&    ( ! bDwmIsCompositionEnabled )
                              )
                              CWnd::GetDesktopWindow()->RedrawWindow(
                                    NULL, NULL,
                                    RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN
                                    );
                  }
            }
      break;

/// END: new code //////////////////////////////////////////////////////////

      case WM_CREATE:
. . .