使用VC开发的一个简单工作日志软件
生活随笔
收集整理的這篇文章主要介紹了
使用VC开发的一个简单工作日志软件
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1,軟件界面
2,示例代碼
void CworklogDlg::OnBnClickedBtnExit() {// TODO: Add your control notification handler code hereCDialog::OnCancel(); }void CworklogDlg::OnBnClickedBtnSave() {// TODO: Add your control notification handler code hereUpdateData(TRUE);// 保存指定日期的工作日志SaveWorkLog(m_time); }void CworklogDlg::OnDtnDatetimechangeDatetimepicker2(NMHDR *pNMHDR, LRESULT *pResult) {LPNMDATETIMECHANGE pDTChange = reinterpret_cast<LPNMDATETIMECHANGE>(pNMHDR);// TODO: Add your control notification handler code here*pResult = 0;UpdateData(TRUE);// 打開指定日期的工作日志OpenWorkLog(m_time);UpdateData(FALSE); }// 打開指定日期的工作日志 void CworklogDlg::OpenWorkLog(CTime time) {CString strDate = time.Format("%Y-%m-%d");CString strFileName;strFileName.Format("%s.txt", strDate);FILE* file;char szLog[10240] = {0};file = fopen( strFileName.GetBuffer(), "rb" );if( NULL != file){fread(szLog, 1, 10240, file );fclose(file);m_strLog = szLog;}else{m_strLog.Empty();} }// 保存指定日期的工作日志 void CworklogDlg::SaveWorkLog(CTime time) {CString strData = time.Format("%Y-%m-%d");CString strFileName;strFileName.Format("%s.txt", strData.GetBuffer());FILE* file;file = fopen( strFileName.GetBuffer(), "w+b" );fwrite(m_strLog.GetBuffer(), m_strLog.GetLength(), 1, file);fclose(file); }3,示例工程下載
http://download.csdn.net/detail/mnorst/3474596
總結(jié)
以上是生活随笔為你收集整理的使用VC开发的一个简单工作日志软件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: react(93)--成功置空
- 下一篇: 【Visual C++】游戏开发笔记二十