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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to monitor remote shell execution on linux 9 100
conditional code and condition difference 9 83
either24  challenge 19 97
post4 challenge 28 101
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

822 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