|
发表于 2020-7-1 23:15:01
|
显示全部楼层
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);
}
上面是按钮的单击事件,IDC_EDIT1为编辑框,可以把aa.txt中的数据读到编辑框中.
运行无误....... |
|