ex73View.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:3k
源码类别:
书籍源码
开发平台:
Visual C++
- // ex73View.cpp : implementation of the CEx73View class
- //
- #include "stdafx.h"
- #include "ex73.h"
- #include "ex73Doc.h"
- #include "ex73View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEx73View
- IMPLEMENT_DYNCREATE(CEx73View, CView)
- BEGIN_MESSAGE_MAP(CEx73View, CView)
- //{{AFX_MSG_MAP(CEx73View)
- ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
- ON_COMMAND(ID_FileDlg, OnFileDlg)
- //}}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()
- /////////////////////////////////////////////////////////////////////////////
- // CEx73View construction/destruction
- CEx73View::CEx73View()
- {
- // TODO: add construction code here
- }
- CEx73View::~CEx73View()
- {
- }
- BOOL CEx73View::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx73View drawing
- void CEx73View::OnDraw(CDC* pDC)
- {
- CEx73Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx73View printing
- BOOL CEx73View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CEx73View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CEx73View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx73View diagnostics
- #ifdef _DEBUG
- void CEx73View::AssertValid() const
- {
- CView::AssertValid();
- }
- void CEx73View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CEx73Doc* CEx73View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx73Doc)));
- return (CEx73Doc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEx73View message handlers
- void CEx73View::OnFileOpen()
- {
- CString filter="TXT Files(*.txt)|*.txt||";
- CFileDialog mydialog(TRUE,0,0, OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY, filter);
- if(mydialog.DoModal()==IDOK)
- {
- CString str=mydialog.GetPathName();
- MessageBox(str);
- }
- }
- void CEx73View::OnFileDlg()
- {
- CString filter="TXT Files(*.txt)|*.txt||";
- CFileDialog mydialog (TRUE, 0, 0, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY, filter);
- if(mydialog.DoModal()==IDOK)
- {
- CString str=mydialog.GetPathName();
- MessageBox(str); //显示用户选择的路径及全名
- }
- }