我使用了一个窗口分割,下面的窗口为CMyEditView继承自CEditView,上面的窗口为CMyFromView继承自CFormView。在CLineView中有个按钮控件IDC_BUTTON1,我为它生成了一个响应函数OnButton1()。我想点击此按钮让CMyEditView显示出一定的信息,在网上参考了一些方法,但是都遇到了问题,代码如下:
在CMyFormView中:
void CMyFormView::OnButton1() 
{
// TODO: Add your control notification handler code here
         CMyEditView *m_pMyEditView;
         /////////////////Method One/////////////////
/* CEdit& debugEdit = m_pMyEditView->GetEditCtrl(); 
int nLen = debugEdit.GetWindowTextLength();
debugEdit.SetFocus();
debugEdit.SetSel(nLen, nLen);
debugEdit.ReplaceSel("hehe");*/
/////////////Method Two/////////////////
/*  m_pMyEditView = (CMyEditView*)((CFrameWnd*)AfxGetApp()->m_pMainWnd)->GetActiveView();
m_pMyEditView->Display(); */
/////////////Method Three/////////////////
/* CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
m_pMyEditView = (CMyEditView*)pFrame->GetActiveView();
m_pMyEditView->Display(); */
/////////////Method FOUR///////////////
/* m_pMyEditView = (CMyEditView *)(((CMainFrame*)GetParent())->GetPane(1, 0));
m_pMyEditView->Display(); */
}在CMainFrame中:
CWnd* GetPane(int row, int col) {return m_wndSplitter.GetPane (row,col); }在CMyEditView中:void CMyEditView::Display()
{
         //////////////Method One//////////////////
/* CEdit& debugEdit = GetEditCtrl(); 
int nLen = debugEdit.GetWindowTextLength();
debugEdit.SetFocus();
debugEdit.SetSel(nLen, nLen);
debugEdit.ReplaceSel("heihei");
debugEdit.ReplaceSel ("\r\n"); */
/////////////Method Two////////////////
/*       CString str = "hehe";
debugEdit.SetWindowText(str);       */
}OnButton1()函数中第一种方法弹出发送错误报告那种窗口;
第二、第三种方法应该是等同的,都能编译通过,运行也没问题,而且我知道能进入到Display()中,不过出不来信息;
第四种方法出来“Debug Assertion Failed!”的错误!请问是什么问题在作崇,我该如何修改,该如何显示出信息出来????不知道我有没有说清楚,请大家帮忙解决,谢谢各位了!