Pointer to Document from CMainframe Class
C / C++ / MFC
3
Posts
3
Posters
0
Views
1
Watching
-
Hi guys, Does anyone how to create a pointer to the document class while you are in the mainframe class. Raj
GetActiveDocument()
does that! -
Hi guys, Does anyone how to create a pointer to the document class while you are in the mainframe class. Raj
Use: AfxGetApp()->m_pDocManager Here is an modified example that may help:
void MyApp::InvalidateAllViews()
{// Get position of first document template POSITION pos = m\_pDocManager->GetFirstDocTemplatePosition(); while( pos ) { // Get pointer to document template CDocTemplate\* pTemplate = m\_pDocManager->GetNextDocTemplate(pos); // Get position of first document using template POSITION pos2 = pTemplate->GetFirstDocPosition(); while( pos2 ) { // Get pointer to document CMyDoc\* pDoc = (CMysDoc\*)(pTemplate->GetNextDoc(pos2)); if( pDoc ) { // Get position of first view POSITION pos3 = pDoc->GetFirstViewPosition(); while( pos3 ) { // Get pointer of next view CMyView\* pView = (CVMyView\*)(pDoc->GetNextView(pos3)); pView->Invalidate(); } } } }
}
INTP