FIX: CMDIFrameWnd Caption Not Updated When Child ClosedLast reviewed: September 18, 1997Article ID: Q126301 |
1.50 1.51 | 1.00 2.00
WINDOWS | WINDOWS NTkbprg kbbuglist kbfixlist The information in this article applies to:
SYMPTOMSClosing a maximized MDI child window will not update the main frame window caption if the frame window is narrower than the menu bar (menu has wrapped to the second line). This causes the main frame window to show a document name even if no documents are open.
CAUSEIf the main frame window is narrower than the menu, CMDIChildWnd::OnSize() is called twice, which calls GetMDIFrame()->OnUpdateFrameTitle(TRUE) to update the frame window caption. The last time OnUpdateFrameTitle(TRUE) is called, it updates the frame window caption with the previous document name, even though the document is closed.
RESOLUTIONOverride CMDIChildWnd::DestroyWindow() to turn off FWS_ADDTOTITLE for the main frame window during the destroy window call for maximized child windows. Follow these steps:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 2.10 for Windows NT.
MORE INFORMATIONWhen the child window is maximized and the main frame window is wider than the menu, the CMDIChildWnd::OnSize() function does not get called when the child window is closed. However, when the frame window is narrower than the menu, CMDIChildWnd::OnSize() gets called twice when the child window is closed, first with SIZE_MAXIMIZED and then with SIZE_RESTORED. CMDIChildWnd::OnSize() calls GetMDIFrame()->OnUpdateFrameTitle(TRUE). The first time CMDIChildWnd::OnSize() is called (with SIZE_MAXIMIZED), OnUpdateFrameTitle() updates the frame window's caption correctly, but redundantly. The second time MDIChildWnd::OnSize() is called (with SIZE_RESTORED), OnUpdateFrameTitle() decides there is a current document because its call to GetActiveDocument() returned a valid pointer and it updates the frame window's caption with the document name. This bug can be seen in the MFC sample "MULTIPAD" included with Visual C++.
|
Additional reference words: 1.50 1.51 1.00 2.00 2.50 2.51 2.10 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |