Article ID: 111814
Article Last Modified on 11/21/2006
/* Compile options needed:
*/
void Some_Function()
{
CMyDoc *pActiveDoc; // CMyDoc derived from CDocument
CMyFrame *pActiveFrame; // CMyFrame derived from CMDIChildWnd
pActiveFrame =(CMyFrame*)
((CMainFrame*)(AfxGetApp()-<m_pMainWnd))-<MDIGetActive();
// MFC 2.5 and later versions contain AfxGetMainWnd(), which
// can be used to gain access to the main window instead of
// "AfxGetApp()->m_pMainWnd
pActiveDoc = (CMyDoc*)pActiveFrame->GetActiveDocument();
}
Additional query words: MFC CDocument kbSweptVC600
Keywords: kbhowto kbdocview KB111814