See also :) :
void CMainFrame::ProcessDocsAndViewsCalls(CYourDocCallParameter* pcDocPar,
CYourViewCallParameter* pcViewPar)
{
CWinApp* pcWinApp = AfxGetApp();
POSITION pos(pcWinApp->GetFirstDocTemplatePosition());
while (pos) {
CDocTemplate* pcTemplate(pcWinApp->GetNextDocTemplate(pos));
ASSERT(pcTemplate && pcTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate)));
POSITION posDoc(pcTemplate->GetFirstDocPosition());
while (posDoc) {
CDocument* pcDoc(pcTemplate->GetNextDoc(posDoc));
ASSERT(pcDoc);
if (pcDoc->IsKindOf(RUNTIME_CLASS(CYourDoc))) {
CYourDoc* pcYourDoc((CYourDoc*) pcDoc);
pcYourDoc->TakeIt(pcDocPar); POSITION posView(pcYourDoc->GetFirstViewPosition());
while (posView) {
CView* pcView(pcYourDoc->GetNextView(posView));
ASSERT(pcView);
if (pcView->IsKindOf(RUNTIME_CLASS(CYourView))) {
CYourView* pcYourView((CYourView*) pcView);
pcYourView->TakeIt(pcViewPar); }
}
}
}
}
}