19,469
社区成员
发帖
与我相关
我的任务
分享
CString ReCord::Read(LPCTSTR lpszFile)
{
if (NULL == lpszFile || '\0' == *lpszFile)
return _T("");
CFile file;
CString strText(_T(""));
if (file.Open(lpszFile, CFile::modeRead))
{
//获取文件的长度。
DWORD dwLen = file.GetLength();
if (dwLen > 0)
{
//读取文件内容。
file.ReadHuge(strText.GetBuffer(dwLen), dwLen);
strText.ReleaseBuffer();
}
file.Close();
}
return strText;
}
int ReCord::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CUIWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CenterWindow();
// TODO: Add your specialized creation code here
//将文本内容写入文本框。
GetDlgItem(IDC_EDT_RECORD)->SetWindowText(Read(m_strPath));
return 0;
CenterWindow();
}