怎样在CMainFrame中获得任一文档(非活动)的指针?

exJeff 2005-08-10 12:26:54
m_pPlcFrame=new CTheChildFrame;//CTheChildFrame* m_pPlcFrame
CCreateContext context;
context.m_pNewViewClass=RUNTIME_CLASS(CPlcView);
if(!m_pPlcFrame->LoadFrame(IDR_MAINFRAME,WS_THICKFRAME |WS_CHILD|WS_MAXIMIZE,this,&context))return;
m_pPlcFrame->InitialUpdateFrame(pDoc,TRUE);//

//CTheChildFrame派生于CMDIChildFrame.
//我需要动态创建一个带文档的视图类。InitialUpdatefame中的第一个参数我希望是指向CPlcDoc的指针。
...全文
78 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
colme 2005-08-14
  • 打赏
  • 举报
回复
CMyApp * pMyApp = (CMyApp *)AfxGetApp();
POSITION p = pMyApp->GetFirstDocTemplatePosition();
while(p!= NULL)
{
CDocTemplate * pDocTemplate = pMyApp->GetNextDocTemplate(p);
POSITION p1 = pDocTemplate->GetFirstDocPosition();
while(p1 != NULL)
{
CDocument * pDocument = pDocTemplate->GetNextDoc(p1);
}
}
用以上程序可以遍历应用程序所有文档。

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧