从CTestView获取CSideView
CView* CTestView::GetView(CRuntimeClass* pClass)
{
CTestDoc* pDoc=(CTestDoc*)GetDocument();
CView* pView;
POSITION pos=pDoc-> GetFirstViewPosition();
while(pos!=NULL)
{
pView=pDoc-> GetNextView(pos);
if(pView-> IsKindOf(pClass))
break;
}
if(!pView->IsKindOf(pClass))
{
AfxMessageBox( "Can't Locate the View.");
return NULL;
}
return pView;
}
直接在CTestView里需要的地方调用:CSideView* psview=(CSideView*)GetView(RUNTIME_CLASS(CSideView));
然后爱干嘛干嘛。例如把CSideView里的一个CArray 数组sidePointArry的值赋值给p:
p=psview->sidePointArry.GetAt(i);