|
void CADlg::OnButton3()
{
// TODO: Add your control notification handler code here
CString str;
UpdateData();
CStdioFile nameFile;
try
{
CString a;
nameFile.Open("g:\\aa.txt",CFile::modeRead);
nameFile.ReadString(str);
nameFile.Close();
}
catch(CFileException)
{return;}
UpdateData(FALSE);
CWnd *pWnd;
pWnd=this->GetDlgItem(IDC_EDIT1);
pWnd->SetWindowText(str);
}
The above is the button click event, IDC_EDIT1 is the edit box, and the data in aa.txt can be read into the edit box.
Operation is correct... |
|