【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-CFile_5View.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// CFile_5View.cpp : implementation of the CCFile_5View class
//
#include "stdafx.h"
#include "CFile_5.h"
#include "NewDlg.h"
#include "CFile_5Doc.h"
#include "io.h"
#include "fcntl.h"
#include "CFile_5View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCFile_5View
IMPLEMENT_DYNCREATE(CCFile_5View, CView)
BEGIN_MESSAGE_MAP(CCFile_5View, CView)
//{{AFX_MSG_MAP(CCFile_5View)
ON_COMMAND(IDM_EXIST, OnExist)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCFile_5View construction/destruction
CCFile_5View::CCFile_5View()
{
// TODO: add construction code here
}
CCFile_5View::~CCFile_5View()
{
}
BOOL CCFile_5View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCFile_5View drawing
void CCFile_5View::OnDraw(CDC* pDC)
{
CCFile_5Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCFile_5View printing
BOOL CCFile_5View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCFile_5View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCFile_5View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCFile_5View diagnostics
#ifdef _DEBUG
void CCFile_5View::AssertValid() const
{
CView::AssertValid();
}
void CCFile_5View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCFile_5Doc* CCFile_5View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCFile_5Doc)));
return (CCFile_5Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCFile_5View message handlers
void CCFile_5View::OnExist()
{
// TODO: Add your command handler code here
CNewDlg dlg;
dlg.DoModal();
load=dlg.m_load;
int test;
if ((test=open(load, _O_RDONLY)) < 0)
{
MessageBox("文件不存在");
return;
}
else
{
MessageBox("文件已存在");D:\
return;
}
_lclose(test);
}