Link to home
Start Free TrialLog in
Avatar of Tauli
Tauli

asked on

MFC-FeaturePack - MDI - get all Views

Hi,

how do i iterate between all Views with using MFC-FeaturPack (VS2008)?

iterate all childs of the parentwindow from MDIGetActiveView() is not successfully...
CMDIChildWnd *activeChild = MDIGetActive();				
ASSERT(activeChild);	
CWnd *client = activeChild->GetParent();	
ASSERT(client);
CWnd* hChild = client->GetWindow(GW_CHILD);
CScriptView *sv = NULL;
while(hChild){		
	if(hChild->IsKindOf(RUNTIME_CLASS(CView))){
TRACE(_T("is CView-Class\n")); // not working
	}
	hChild = hChild->GetWindow(GW_HWNDNEXT);
}

Open in new window

Avatar of jkr
jkr
Flag of Germany image

Have you tried 'GetNextView()' (http://msdn.microsoft.com/en-us/library/d6718830%28VS.80%29.aspx)? I.e.
void CMyDoc::EnumAllViews()
{
   POSITION pos = GetFirstViewPosition();
   while (pos != NULL)
   {
      CView* pView = GetNextView(pos);
      // do something...
   }   
}

Open in new window

Avatar of Tauli
Tauli

ASKER

i think your sample enumerates all views of a doc, i mean in a multiview-onedoc situation this is not what i search...

i can get every first view of a doc. how can i enumerate all docs?

i enum in CMainFrame

ASKER CERTIFIED SOLUTION
Avatar of Tauli
Tauli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial