Solved

Iterate through all open child frames

Posted on 2007-03-30
2
497 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

744 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

18 Experts available now in Live!

Get 1:1 Help Now