转载自
在OnCreat()中创建控件
在OnInitUpdate()中初始化控件 int CYourView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFormView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here myButton.Create("abc",WS_CHILD|WS_VISIBLE, CRect(23,203,160,265),this,ID_MYBUTTON); return 0; } void CYourView::OnInitialUpdate() { CFormView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CString str="Your string"; myButton.SetWindowText(str); }