16,473
社区成员
发帖
与我相关
我的任务
分享
CDocManager * pDocManager = AfxGetApp()->m_pDocManager;
POSITION posDocManager = pDocManager->GetFirstDocTemplatePosition();
while(posDocManager != NULL)
{
CDocTemplate * pDocTemplate = (CDocTemplate *)pDocManager->GetNextDocTemplate(posDocManager);
POSITION posDoc = pDocTemplate->GetFirstDocPosition();
while(posDoc != NULL)
{
CDocument * pDoc = pDocTemplate->GetNextDoc(posDoc);
if (pDoc->GetTitle() == szName)
{
POSITION posView = pDoc->GetFirstViewPosition();
while (posView != NULL)
{
CView * pView = pDoc->GetNextView(posView);
CMainFrame * pMainFrame = (CMainFrame *)AfxGetMainWnd();
pMainFrame->SetActiveView(pView);
}
}
}
}
大哥,这是我的实现代码,但是它并不能激活所对应的视图,能帮我看看问题在哪吗?谢谢!
CDocManager * pDocManager = AfxGetApp()->m_pDocManager;
POSITION posDocManager = pDocManager->GetFirstDocTemplatePosition();
while(posDocManager != NULL)
{
CDocTemplate * pDocTemplate = (CDocTemplate *)pDocManager->GetNextDocTemplate(posDocManager);
POSITION posDoc = pDocTemplate->GetFirstDocPosition();
while(posDoc != NULL)
{
CDocument * pDoc = pDocTemplate->GetNextDoc(posDoc);
if (pDoc->GetTitle() == szName)
{
POSITION posView = pDoc->GetFirstViewPosition();
while (posView != NULL)
{
CView * pView = pDoc->GetNextView(posView);
CMainFrame * pMainFrame = (CMainFrame *)AfxGetMainWnd();
pMainFrame->SetActiveView(pView);
}
}
}
}
大哥,这是我的实现代码,但是它并不能激活所对应的视图,能帮我看看问题在哪吗?谢谢!