void CNotebookDlg::OnChangeRichedit1() 
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
CString strText="";
m_RichEdit.GetWindowText(strText);
if(strText=="")  
{
m_ToolBar.GetToolBarCtrl().EnableButton(ID_EDIT_COPY,FALSE); 
m_ToolBar.GetToolBarCtrl().EnableButton(ID_EDIT_CUT,FALSE);
}
else 
{
m_ToolBar.GetToolBarCtrl().EnableButton(ID_EDIT_COPY,TRUE); 
m_ToolBar.GetToolBarCtrl().EnableButton(ID_EDIT_CUT,TRUE);
}
// TODO: Add your control notification handler code here

}
预想功能:用onchange判断编辑框内是否有内容,无内容时将工具栏中的 复制 剪切 置灰,有内容时则恢复。
但是没有反应呀。

解决方案 »

  1.   

    EN_CHANGE
    The EN_CHANGE notification message is sent when the user has taken an action that may have altered text in an edit control. 
    ====================================================================================
    用户改变文本了才发送EN_CHANGE,你确定文本改变了么?
      

  2.   

    控件关联CString变量,UpdateData(TRUE);
      

  3.   

    是不是只要m_RichEdit编辑框中有输入就文本改变了吧?
    我是菜鸟,对不起,不太懂。
    还有UpdateData(TRUE);怎么控件关联呀?是直接把它加到void CNotebookDlg::OnChangeRichedit1() 里面就行了吗?