voidCCalDlg::OnButtonadd(){ //TODO:Addyourcontrolnotificationhandlercodehere UpdateData(); isresult=TRUE; num1=m_edit; m_edit=""; UpdateData(false); oper=1;}voidCCalDlg::OnButtondeng(){ //TODO:Addyourcontrolnotificationhandlercodehere UpdateData(); num2=m_edit; doubleresult=0; doublefirnum=atof(num1); doublesecnum=atof(num2); switch(oper) {case1:result=firnum+secnum; m_edit.Format("%g",result); UpdateData(false); break;}}在使用m_edit前,要先updatedata更新控件内容到变量。