分类:
2008-09-17 11:11:48
void CVWFILEDlg::OnCloseupDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CDateTimeCtrl* pFileTime = (CDateTimeCtrl*)GetDlgItem(IDC_DATETIMEPICKER1);
CTime itemTime;
pFileTime->GetTime(itemTime);
CString FileName = itemTime.Format("%Y-%m-%d");
FileName+= ".txt";
char* pFileName = FileName.GetBuffer(FileName.GetLength() + 1);
CStatic* pStatic;
pStatic = (CStatic*)GetDlgItem(IDC_STATIC);
CFile f;
CFileException e;
if( !f.Open( pFileName, CFile::modeRead, &e ) )
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
}
int flength = f.GetLength();
char* filecontent = new char[flength];
f.SeekToBegin();
f.Read(filecontent,flength);
pStatic->SetWindowText(filecontent);
f.Close();
*pResult = 0;
}