home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
- #include "cmdlearn.h"
- #include "doc.h"
- #include "view.h"
- #include <stdio.h>
- #include <string.h>
- #include <mmsystem.h>
-
- IMPLEMENT_DYNCREATE(CFileView, CView)
-
- BEGIN_MESSAGE_MAP(CFileView, CView)
- //{{AFX_MSG_MAP(CFileView)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- CFileView::CFileView()
- {
- }
-
- CFileView::~CFileView()
- {
- }
-
- /////////////////
- // Update this view. If the hint is that the document was deleted,
- // close the window and play a little cork pop sound.
- //
- void CFileView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
- {
- if (lHint==ID_FILE_CLOSE) {
- PostMessage(WM_COMMAND, ID_FILE_CLOSE);
- PlaySound(MAKEINTRESOURCE(IDR_FILEINTYPE),
- AfxGetInstanceHandle(), SND_RESOURCE | SND_NODEFAULT | SND_NOWAIT);
- return;
- }
- TView::OnUpdate(pSender, lHint, pHint);
- }
-
- //////////////////
- // Display file informationin in window.
- //
- void CFileView::OnDraw(CDC* pDC)
- {
- CFileDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- const CFileStatus& status = pDoc->m_status;
- char strbuf[1024];
- sprintf(strbuf,"File:\t%s\nSize:\t%ld",
- (const char*)pDoc->GetPathName(),
- status.m_size);
-
- // Build text string, then draw it
- CString msg = strbuf;
- msg += status.m_ctime.Format("\nCreated:\t%m-%d-%y %I:%M %p");
- msg += status.m_atime.Format("\nAccess:\t%m-%d-%y %I:%M %p");
- msg += status.m_mtime.Format("\nMod:\t%m-%d-%y %I:%M %p");
-
- CRect rc;
- GetClientRect(&rc);
- pDC->DrawText(msg, msg.GetLength(), rc, DT_EXPANDTABS);
- }
-
-