高手进。。。多视图通信。
单文档多视图之间通信方式。。。。。。。。。
多文档多视图之间通信方式。。。。。。。。。
越全越好,需要分的,另外开帖子给分。。。
谢谢。
问题点数:100、回复次数:6Top
1 楼BoXoft()回复于 2006-11-03 19:26:14 得分 0
这些视图都可以访问CMainFrame和C***App,可以考虑用这两个类中转。
《VC6技术内幕》第20章“Splitter Windows and Multiple Views”中有4个例子可以看看。Top
2 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2006-11-03 20:21:34 得分 0
通过消息来吧。Top
3 楼seu07201213(【_】〖汪洋中的一片叶子〗≈^︵^≈)回复于 2006-11-03 20:45:18 得分 10
通信方式 都是发消息,消息对象可通过
AfxGetMainWnd , GetActiveView ,GetActiveDocument , CView::GetDocument,
CMDIFrameWnd ::MDIGetActive , CMDIFrameWnd::MDINext 等等函数获得Top
4 楼Stefine(CSDN最菜滴猩猩)回复于 2006-11-03 22:09:41 得分 50
1:视图与文档
视图->文档
CTestView::下
CTestDoc *pDoc = (CTestDoc *)this->m_pDocumet;
文档->视图
POSTION pos = GetFirstViewPosition();
while( NULL != pos)
{
CView * pView = GetNextView(pos );
}
2:框架内获得文档指针
CView *pView = GetActiveView();
if( NULL != pView )
CDocument *pDoc = pView->GetDocumet;
或直接
CDocument *pDoc = GetActiveDocument();
3:框架内获得视图指针
CDocument *pDoc = GetActiveDocument();
POSITON pos = pDoc->GetFirstViewPositon();
while( NULL != pos )
{
CView * pView = GetNextView(pos );
}
差不多就那几个函数打转了,方法也类似
Top
5 楼jyl168(jiangyouliang)回复于 2006-11-05 17:03:03 得分 0
比如在一个 VIEW 里面放另一个 VIEW 的指针,如何实现?嘿嘿。Top
6 楼BoXoft()回复于 2006-11-05 19:13:51 得分 40
可以考虑在CMainFrame保存所有视图类的指针(初始NULL)。当某个视图类要访问其他视图类的时候,先使用(CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();)得到主框架指针,再获取其他视图类的指针。Top




