void CEditControlDlg::OnClickedButton() { // TODO: Add your control notification handler code here //獲得EDIT CEdit* pBoxOne; pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT); //賦值 //pBoxOne-> SetWindowText( _T("FOO ") ); //取值 CString str; pBoxOne-> GetWindowText(str); MessageBox(str,_T("程序運行結果"),MB_OK); str.ReleaseBuffer(); }
運行結果: