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 » OnClose Main-Frame problem Collapse All
Subject Author Date
Offer Har Jan 10, 2008 - 2:59 PM

I have a main-frame defined as follows:
class CMainFrame : public CExtNCW<CMDIFrameWnd>
In the OnClose I add a check if my document was saved, if not I call AfxMessageBox to display a message to the user.

When the message-box is displayed, if the main-frame is maximized, the main-frame expands by few pixels.

I was able to reproduce it easily by adding OnClose to the CMainFrame in MDIDOCVIEW:

Add this to the MainFrm.cpp:

in the message map:

ON_WM_CLOSE()
And the function (add declaration of-course...)
void CMainFrame::OnClose()
{
	AfxMessageBox("RON");
	CExtNCW<CMDIFrameWnd>::OnClose();
}

Note: I use two monitors in dual display mode.

Offer Har Jan 23, 2008 - 8:19 AM

Dear support,

Can you please verify that this problem will be fixed?
I am waiting for response for almost two weeks.

Ron.

Technical Support Jan 11, 2008 - 8:35 AM

Thank you for reporting this problem. You can fix it by updating the following part of the CExtNcFrameImpl::NcFrameImpl_PreWindowProc() method:

      case WM_ACTIVATE:
            m_bNcFrameImpl_IsActive = ( LOWORD(wParam) == WA_INACTIVE ) ? false : true;
            if(         pWndFrameImpl->IsWindowEnabled()
                  &&    (     (! NcFrameImpl_IsForceEmpty() )
                        ||    (! NcFrameImpl_IsForceEmptyNcBorderEmpty() )
                        )
                  )
            {
                  NcFrameImpl_DelayRgnAdjustment();
                  NcFrameImpl_SetupRgn();
                  pWndFrameImpl->SendMessage( WM_NCPAINT );
            }
            else
            {
                  if( NcFrameImpl_IsDwmCaptionReplacement() )
                  {
                        if( m_pNcFrameImplBridge != NULL )
                        {
                              HWND hWnd = m_pNcFrameImplBridge->NcFrameImplBridge_GetSafeHwnd();
                              if( hWnd != NULL && ::IsWindow( hWnd ) )
                                    ::RedrawWindow(
                                          hWnd,
                                          NULL,
                                          NULL,
                                          RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW|RDW_ALLCHILDREN
                                          );
                        }
                        HWND hWndOwn = NcFrameImpl_OnQueryHWND();
                        ASSERT( hWndOwn != NULL && ::IsWindow(hWndOwn) );
                        ::SendMessage( hWndOwn, WM_NCPAINT, 0L, 0L );
                        break;
                  } // if( NcFrameImpl_IsDwmCaptionReplacement() )
            }
      break;

Offer Har Jan 11, 2008 - 8:57 AM

Dear Support,

This solve only part of the problem - when the message-box is displayed then all is fine.
However, if the user selects to cancel the closing (My message-box allows for this, and in in the code - I don’t call OnOclose of the base) this stretch remains.
You can implement this by removing this line in OnClose:

CExtNCW<CMDIFrameWnd>::OnClose();