15,981
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
/*
CString str;
GetDlgItem(IDC_EDIT1)->GetWindowText(str);
MessageBox(str);
*/
/*
CString str;
GetDlgItemText(IDC_EDIT1,str);
MessageBox(str);
*/
//上面两种办法最后都是通过调用API的实现的,殊途同归
char str[20]={0};
::GetWindowText(::GetDlgItem(m_hWnd,IDC_EDIT1),str,20);
MessageBox(str);
CString str;
CWnd * pWnd = GetDlgItem( IDC_EDIT1 );
pWnd->GetWindowText( str );
MessageBox( str );
CString str;
GetDlgItemText(IDC_EDIT1,str);
MessageBox(str);
CString str;
GetDlgItem(IDC_EDIT1)->GetWindowText(str);
MessageBox(str);