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 Tech Support » Unhandled exception when calling Print Preview menu in RibbonBar sample application Collapse All
Subject Author Date
Roongrit Charoensupkul Jan 9, 2008 - 12:04 AM

I’m running the sample application, RibbonBarMDI. When I click Print Preview menu, the alert dialog pop up. Here is the detail:

"unhandled exception at 0x7833d6eb in RibbonBarMDI-ud.exe:0xC0000005: Access violation reading location 0x024e41d4."

When I click break button, it stop in CExtPopupMenuWnd::OnTimer(...) function, in ID_TIMER_FADE_OUT_ANIMATION case. Please let me know how to solve this issue.

Thanks

Technical Support Jan 9, 2008 - 9:52 AM

Thank you for reporting this issue. To fix it please, update the following part of the CExtPopupMenuWnd::OnTimer() method:

      case ID_TIMER_FADE_OUT_ANIMATION:
      {
            if( m_nFadeOutAnimationStepIndex < m_nFadeOutAnimationStepCount )
            {
                  CExtPopupMenuWnd * pPopup;
                  for( pPopup = this; pPopup != NULL; pPopup = pPopup->m_pWndParentMenu )
                  {
                        if( pPopup->GetSafeHwnd() == NULL )
                              continue;
                        ASSERT( g_PaintManager.m_pfnSetLayeredWindowAttributes != NULL );
                        if( (pPopup->GetStyle()&WS_VISIBLE) == 0 )
                              continue;
                        if( m_nFadeOutAnimationStepIndex == 0 )
                        {
                              pPopup->m_bHelperAnimationControllerDetected = true;
                              if(         (pPopup->GetExStyle()&(__EXT_MFC_WS_EX_LAYERED|WS_EX_TRANSPARENT)) !=
                                                (__EXT_MFC_WS_EX_LAYERED|WS_EX_TRANSPARENT)
                                    )
                              pPopup->ModifyStyleEx( 0, (__EXT_MFC_WS_EX_LAYERED|WS_EX_TRANSPARENT) );
                              pPopup->EnableWindow( FALSE );
                        }
                        BYTE nAlpha = (BYTE)
                              ::MulDiv(
                                    m_nFadeOutAnimationStepCount - m_nFadeOutAnimationStepIndex - 1,
                                    255,
                                    m_nFadeOutAnimationStepCount
                                    );
                        g_PaintManager.m_pfnSetLayeredWindowAttributes( pPopup->m_hWnd, 0, nAlpha, __EXT_MFC_LWA_ALPHA );
                        if(         pPopup->m_ctrlShadow.GetSafeHwnd() != NULL
                              &&    (pPopup->m_ctrlShadow.GetStyle()&WS_VISIBLE)
                              )
                              pPopup->m_ctrlShadow.UpdateWindowLayer( nAlpha );
                        CExtPaintManager::stat_PassPaintMessages();
                  }
                  m_nFadeOutAnimationStepIndex ++;
            }
            else
            {
                  KillTimer( nIDEvent );
                  if( m_ctrlShadow.GetSafeHwnd() != NULL )
                        m_ctrlShadow.DestroyWindow();
                  CExtPopupMenuWnd * pPopup = this;
                  for( ; pPopup != NULL; )
                  {
                        VERIFY( pPopup->_BuildItems( NULL, true ) );
                        if(         pPopup->m_ctrlShadow.GetSafeHwnd() != NULL
                              &&    (pPopup->m_ctrlShadow.GetStyle()&WS_VISIBLE)
                              )
                              pPopup->m_ctrlShadow.DestroyWindow();
                        HWND hWnd = pPopup->m_hWnd;
                        pPopup = pPopup->m_pWndParentMenu;
                        ::DestroyWindow( hWnd );
                  }
            }
      }
      return;