////////////////////////////////////////////////////////////////////////////// // MFC Tip #6 -- Vision X Software -- http://www.visionx.com/mfcpro // Getting from a view to the document, and vice-versa // // This source code is provided for instructional purposes, and is released // to the public domain. No claim of ownership is made. Use it at your own // risk. No warranties are expressed or implied. The resulting program may // not be fully functional. No animals were used to test this code. ////////////////////////////////////////////////////////////////////////////// // To get the document for a given view. pView->GetDocument(); // pView is a CView* // To get the first view in the list of views. POSITION pos = GetFirstViewPosition(); CView* pFirstView = GetNextView(pos); // To loop through the list of views. POSITION pos = GetFirstViewPosition(); while (pos) { CView* pView = GetNextView(pos); // Use the view. }