如何在document 里面取得view的指针,超级高手请务必留言!!
在xxdoc.cpp里做成以下函数:以取得象view 里面的GetDocument 函数的功能,
请问这样写会有什么潜在的缺陷么?
Cview *Cxxdoc::GetView(CRuntimeClass *pClass)
{
Cview* pview;
POSITION pos = GetFirstViewPosition();
while(pos!=NULL)
{
pview = GetNextView(pos);
if (!pview->IsKineOf(pClass));
break;
}
if (!pview->IsKineOf(pClass))
{
AfxMessageBox("Can Not Locate The VIew!");
}
}