给这个控件设一个类:CReadEdit, 继承自CEditView
CMainFrame* pFrame = (CMainFrame*)AfxGetMainFrame();
CXXDoc* pDoc = (CXXDoc*)pFrame-> GetActiveDocument();
POSITION pos = pDoc-> GetFirstViewPosition();
while(pos != NULL)
{
CView* pView = pDoc-> GetNextView(pos);
if(pView != NULL)
{
if(pView-> IsKindOf(RUNTIME_CLASS(CReadEdit)))
{
CReadEdit* pEdit = (CReadEdit*)pView;
if(pEdit)
{
CString sMsg = _T( "hello. ");
pEdit-> GetEditCtrl().SetWindowText(sMsg);
}
}
}
}
转载于:https://blog.51cto.com/tuoxie174/601982