![控件与父窗口消息传递 控件与父窗口消息传递](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
void CAddDlg::OnAdd()
{
// TODO: Add your control notification handler code here
int n1,n2,n3;
char c1[12],c2[12],c3[12];
::SendMessage(GetDlgItem(IDC_EDIT1)->m_hWnd,WM_GETTEXT,10,(LPARAM)c1);
::SendMessage(GetDlgItem(IDC_EDIT2)->m_hWnd,WM_GETTEXT,10,(LPARAM)c2);
n1=atoi(c1);
n2=atoi(c2);
n3=n1+n2;
itoa(n3,c3,10);
::SendMessage(GetDlgItem(IDC_EDIT3)->m_hWnd,WM_SETTEXT,0,(LPARAM)c3);
}