//get first doc template
POSITION posTemp = theApp.GetFirstDocTemplatePosition();
while(posTemp)
{ // traversal doc template
CDocTemplate *pDocTemp = theApp.GetNextDocTemplate(posTemp);
POSITION posDoc = pDocTemp->GetFirstDocPosition();
while(posDoc)
{ // traversal document
CDocument *pDoc = pDocTemp->GetNextDoc(posDoc);
// pDoc represent every document …
POSITION posView=pDoc->GetFirstViewPosition();
while(posView)
{ // get first view
CView2D *pView=(CView2D*)(pDoc->GetNextView(posView));
// pView represent every view …
}
}
}