CWinApp* pApp=AfxGetApp();
POSITION templatepos=pApp->GetFirstDocTemplatePosition();
bool bfind=false;
while(pos!=NULL)
{
if(bfind)
break;
CDocTemplate* doctemplate=pApp->GetNextDocTemplate(templatepos);
POSITION docpos=doctemplate->GetFirstDocPosition( );
while(docpos)
{
CDocument* pdoc=doctemplate->GetNextDoc(docpos);
CString docpath=pdoc->GetPathName();
if(docpath=="c:\\tmp\\test.doc")
{
POSITION pos = GetFirstViewPosition();
CView* pFirstView = GetNextView( pos );
CMDIFrameWnd* pFrame=(CMDIFrameWnd*)AfxGetMainWnd();
pFrame->MDIActive(pFirstView);
bfind=true;
break;
}
}
}
POSITION templatepos=pApp->GetFirstDocTemplatePosition();
bool bfind=false;
while(pos!=NULL)
{
if(bfind)
break;
CDocTemplate* doctemplate=pApp->GetNextDocTemplate(templatepos);
POSITION docpos=doctemplate->GetFirstDocPosition( );
while(docpos)
{
CDocument* pdoc=doctemplate->GetNextDoc(docpos);
CString docpath=pdoc->GetPathName();
if(docpath=="c:\\tmp\\test.doc")
{
POSITION pos = GetFirstViewPosition();
CView* pFirstView = GetNextView( pos );
CMDIFrameWnd* pFrame=(CMDIFrameWnd*)AfxGetMainWnd();
pFrame->MDIActive(pFirstView);
bfind=true;
break;
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货