How to get a list of opened MDI child windows in MDI main frame?

How to get a list of opened MDI child windows in MDI main frame?

Post by Chri » Tue, 08 Jun 2004 14:11:01


To active a speciffic child frame by calling
void CMDIFrameWnd::MDIActivate( CWnd* pWndActivate );
However, how do I get the pointer of the child frame? Should I create an
array variable to keep these pointers? Or there will be more better way?
Thank you!
 
 
 

How to get a list of opened MDI child windows in MDI main frame?

Post by Relvinia » Tue, 08 Jun 2004 14:55:23

CDocument has member functions which you can interate through different
views. Here's an example.

POSITION pos = GetFirstViewPosition();
while (pos)
{
CView* pView = GetNextView(pos);
if (pView)
{
// do something with pView
}
}

Check the help file for more information on these two functions in
CDocument.

Relv

 
 
 

How to get a list of opened MDI child windows in MDI main frame?

Post by Chri » Tue, 08 Jun 2004 15:30:12

But I'm getting the pointers of CMDIChildWnd from CMDIFrameWnd.
 
 
 

How to get a list of opened MDI child windows in MDI main frame?

Post by Relvinia » Wed, 09 Jun 2004 03:02:07

Chris,

For me, I would still use the CDocument to iterate through the views of the
current frame. If you need to find out what views or get pointers to other
frame/views which may be open, you can use the CDocTemplate member functions
to iterate through those documents and get their views to activate.

Relv







an
way?