Manually Cascading through CEditView MDI Childs

Posted on 1998-05-05
Last Modified: 2013-11-20
I am implementing a find and replace feature in a project (MDI) and I decided to give the option of searching through all open views.  How can I gain access to each view sequentially?
Question by:bradk

Accepted Solution

piano_boxer earned 70 total points
ID: 1307697
This code will walk through all open views in a app:

POSITION pos = AfxGetApp()->GetFirstDocTemplatePosition();
    CDocTemplate* pTemplate = AfxGetApp()->GetNextDocTemplate(pos);
    POSITION docpos = pTemplate->GetFirstDocPosition();
        CDocument* pDoc = pTemplate->GetNextDoc(docpos);
        POSITION viewpos = pDoc->GetFirstViewPosition();
            CView* pView = pDoc->GetNextView(viewpos);

            // Do your stuff


Author Comment

ID: 1307698

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 171
Adapt this command to show who installed 29 106
How to determine file rename from EventLog ? 2 43
fizzArray2 challenge 1 72
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now