CMainFrame* pframe=(CMainFrame*)AfxGetMainWnd();
if(pframe!=NULL)
pframe->GetActiveDocument();