文本框

//静态文本框需要将Notify属性设置为TRUE才能有消息
void CdialogDlg::OnClickedNumber1()
{
    CString str;
    GetDlgItem(IDC_Number1)->GetWindowText(str);
    MessageBox(str);
    // TODO: 在此添加控件通知处理程序代码
}


void CdialogDlg::OnBnClickedBtnTest()
{
    int x,y,z;
    char ch1[10],ch2[10],ch3[10];

    GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,10);
    GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,10);

    x = atoi(ch1);
    y = atoi(ch2);
    z = x + y;
    //sprintf(ch3,"%d",z);
    itoa(z,ch3,10);
    //GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
    SetDlgItemText(IDC_EDIT3,ch3);
    // TODO: 在此添加控件通知处理程序代码
}

猜你喜欢

转载自blog.csdn.net/writeeee/article/details/70306734