Solved

Iterate through all open child frames

Posted on 2007-03-30
2
505 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pressing cancel button with C# UI Automation 3 81
zeroFront challenge 7 111
changeXy challenge 13 88
Is there a simple front-end menu system. 9 103
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ā€¦
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

856 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