void CFileTestDlg::OnBnClickedButton3() { // TODO: Add your control notification handler code here CFileDialog dlg(TRUE,NULL,NULL,NULL,NULL); if(dlg.DoModal()==IDOK)// { CString str,str1; str = dlg.GetPathName(); str1 = dlg.GetFileName(); CEdit* cfolder; cfolder = (CEdit*) GetDlgItem(IDC_EDIT1); cfolder->SetWindowText(str); // + 1 } }