HOWTO: Acquire a List of All CDocument Objects Q106455
void CMyApp::GetDocumentList(CObList * pDocList)
{
   ASSERT(pDocList->IsEmpty());
   POSITION pos = GetFirstDocTemplatePosition();
   while (pos)
   {
      CDocTemplate* pTemplate = (CDocTemplate*)GetNextDocTemplate(pos);
      POSITION pos2 = pTemplate->GetFirstDocPosition();
      while (pos2)
      {
         CDocument * pDocument;
         if ((pDocument=pTemplate->GetNextDoc(pos2)) != NULL)
            pDocList->AddHead(pDocument);
      }
   }
} //To get the first view in the list of views:
POSITION pos = GetFirstViewPosition();
CView* pFirstView = GetNextView( pos );
// This example uses CDocument::GetFirstViewPosition
// and GetNextView to repaint each view.
void CMyDoc::OnRepaintAllViews()
{
   POSITION pos = GetFirstViewPosition();
   while (pos != NULL)
   {
      CView* pView = GetNextView(pos);
      pView->UpdateWindow();
   }   
}