多视图识别

CChildFrame   *pChild   =   (CChildFrame   *)   ((CMainFrame*)theApp.GetMainWnd())->GetActiveFrame();  
  CMyDoc*   pDoc   =   NULL;  
  pDoc   =   (CMyDoc*)pChild->GetActiveDocument();  
  CView*   pView;  
  if(pDoc!=NULL)  
  {  
  POSITION   pos=pDoc->GetFirstViewPosition();  
  while(pos!=NULL){  
  pView=pDoc->GetNextView(pos);  
  if(pView->IsKindOf(RUNTIME_CLASS(CMyView)))  
  {  
  break;  
  }  
  }  
  if(pView->IsKindOf(RUNTIME_CLASS(CMyView)))  
  {  
   
  CChildFrame   *pChild   =   (CChildFrame*)pView->GetParentFrame();//获得该view的父窗口  
  pChild->MDIActivate();//激活该父窗口  
   
  }  
  }
posted @ 2011-03-21 22:34  安义  阅读(309)  评论(0编辑  收藏  举报