Solved

Iterate through all open child frames

Posted on 2007-03-30
2
500 Views
Last Modified: 2013-11-20
Hi,

I have a wizard generated MDI application. How can I iterate through all open child frames? I know how to do this in the general case, but my child frames are all using splitter windows. This always returns NULL in this case:

        POSITION posView = pDoc->GetFirstViewPosition();

for my other 'normal' child frame types, it works fine.

Thanks
0
Comment
Question by:DJ_AM_Juicebox
2 Comments
 
LVL 3

Expert Comment

by:paix120
ID: 18826491
Hello, I use a loop like this in my VB.NET code:

Dim ChildForm As Form
For Each ChildForm In Me.MdiChildren
    [code here like ChildForm.GetType.Tostring or whatever info you need for the child]
Next
0
 
LVL 9

Accepted Solution

by:
Priyesh earned 500 total points
ID: 18826805
Try this.
void CMainFrame::OnCountFrames()
{
      POSITION posTemplate = theApp.m_pDocManager->GetFirstDocTemplatePosition() ;
      while(posTemplate != NULL)
      {
            CDocTemplate* pDocTemp = theApp.m_pDocManager->GetNextDocTemplate(posTemplate) ;

            POSITION posDoc = pDocTemp->GetFirstDocPosition() ;
            while(posDoc != NULL)
            {
                  CDocument* pDoc = pDocTemp->GetNextDoc(posDoc) ;
                  POSITION posView = pDoc->GetFirstViewPosition() ;
                  if(posView != NULL)
                  {
                        CView* pView = pDoc->GetNextView(posView) ;            
                        CString szName ;
                        pView->GetParentFrame()->GetWindowText(szName) ;
                        AfxMessageBox(szName) ;
                  }
            }
      }
}
HTH
Priyesh
0

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
Importing  SSL Certificate into Firefox using GPO 28 202
Rewrite URL With Encoded Characters 6 74
Tab names are off by one 5 53
move a line in eclipse 3 80
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

948 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

21 Experts available now in Live!

Get 1:1 Help Now