TCHAR szFilter
[] = _T("文本文件(*.txt)||所有文件(*.*)||");
CFileDialog
fileDlg(TRUE
, _T("txt"), NULL, 0, szFilter
, this);
fileDlg
.DoModal();
CEdit
* pBoxOne
;
pBoxOne
= (CEdit
*)GetDlgItem(IDC_STATIC
);
pBoxOne
->SetWindowTextW(fileDlg
.GetPathName());
CFile
file(fileDlg
.GetPathName(), CFile
::modeRead
);
char* str
= new char[file
.GetLength()];
file
.Read(str
, file
.GetLength() * sizeof(char));
file
.Close();
CEdit
* pBoxOne1
;
pBoxOne1
= (CEdit
*)GetDlgItem(IDC_EDIT1
);
pBoxOne1
->SetWindowTextW(CString(str
));
转载请注明原文地址: https://lol.8miu.com/read-4072.html