Article ID: 129649
Article Last Modified on 11/21/2006
CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->GetActiveFrame();
/* or CMDIChildWnd *pChild =
pFrame->MDIGetActive();
*/
// Get the active view attached to the active MDI child window.
CMyView *pView = (CMyView *) pChild->GetActiveView();
---------------------------
| Frame Window | ---> CMDIFrameWnd
| (main application window) |
---------------------------
|
--------------------
| Client Window | ---> MDICLIENT window class
| (no view attached) |
--------------------
|
-----------------------------------------------------------
| |
--------------------- --------------------
| Child Window 1 | | Child Window 2 | ---> CMDIChildWnd
| (one or more views) | | (one or more views |
--------------------- --------------------
As illustrated in this diagram, the MDI frame window does not have a view
directly associated with it. The views are actually associated with the MDI
child windows.
Additional query words: 1.00 1.50 2.00 2.10 2.50 2.51 2.52 3.00 3.10 4.00
Keywords: kbcode kbdocview kbmdi kbprb kbuidesign KB129649