"UpdateAllViewsInAllDocuments"
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
I want to set the font in a MDI-application. So I need a command like "UpdateAllViewsInAllDocuments", but that doesn't exist. Any suggestions? Thanks :-) Friedrich
-
I want to set the font in a MDI-application. So I need a command like "UpdateAllViewsInAllDocuments", but that doesn't exist. Any suggestions? Thanks :-) Friedrich
You could use:
CWinApp * pApp = AfxGetApp ();
ASSERT_VALID ( pApp );// Iterate through the application's document templates list
POSITION posTemplate = pApp->GetFirstDocTemplatePosition ();while ( NULL != posTemplate ) {
// For each document template object... CDocTemplate \* pTemplate = pApp->GetNextDocTemplate ( posTemplate ); ASSERT\_VALID ( pTemplate ); ASSERT\_KINDOF ( CDocTemplate, pTemplate ); // Iterate through the template's document list POSITION posDocument = pTemplate->GetFirstDocPosition (); while ( NULL != posDocument ) { // For each document object... CDocument \* pDocument = pTemplate->GetNextDoc ( posDocument ); ASSERT\_VALID ( pDocument ); // update the documents view pDocument->UpdateAllViews ( NULL ); }
}
-Ben --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)