home *** CD-ROM | disk | FTP | other *** search
- // fileivw.cpp : implementation of the CFileitView class
- //
-
- #include "stdafx.h"
- #include "fileit.h"
-
- #include "fileidoc.h"
- #include "fileivw.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CFileitView
-
- IMPLEMENT_DYNCREATE(CFileitView, CView)
-
- BEGIN_MESSAGE_MAP(CFileitView, CView)
- //{{AFX_MSG_MAP(CFileitView)
- ON_COMMAND(ID_FILE_TRYIT, OnFileTryit)
- ON_COMMAND(ID_FILE_READIT, OnFileReadit)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CFileitView construction/destruction
-
- CFileitView::CFileitView()
- {
- // TODO: add construction code here
- }
-
- CFileitView::~CFileitView()
- {
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CFileitView drawing
-
- void CFileitView::OnDraw(CDC* pDC)
- {
- CFileitDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CFileitView diagnostics
-
- #ifdef _DEBUG
- void CFileitView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CFileitView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CFileitDoc* CFileitView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFileitDoc)));
- return (CFileitDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CFileitView message handlers
-
- void CFileitView::OnFileTryit()
- {
- // TODO: Add your command handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Display the dlg dialog box.
- dlg.DoModal();
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CFileitView::OnFileReadit()
- {
- // TODO: Add your command handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- UINT BytesRead;
- char FromFile[1000];
-
-
- // Create an object readMe of class CFile
- CFile readMe("MyFile.TXT",
- CFile::modeRead );
-
- // Read the file into FromFile
- BytesRead = readMe.Read ( FromFile,
- 200 );
-
-
- // Add a null terminator
- FromFile[BytesRead] = 0;
-
- // Display it
- MessageBox ( FromFile );
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- }
-