ex125View.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:3k
源码类别:
书籍源码
开发平台:
Visual C++
- // ex125View.cpp : implementation of the CEx125View class
- //
- #include "stdafx.h"
- #include "ex125.h"
- #include "ex125Doc.h"
- #include "ex125View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEx125View
- IMPLEMENT_DYNCREATE(CEx125View, CView)
- BEGIN_MESSAGE_MAP(CEx125View, CView)
- //{{AFX_MSG_MAP(CEx125View)
- ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
- //}}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()
- /////////////////////////////////////////////////////////////////////////////
- // CEx125View construction/destruction
- CEx125View::CEx125View()
- {
- m_hwndMCIWnd=NULL;
- }
- CEx125View::~CEx125View()
- {
- }
- BOOL CEx125View::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx125View drawing
- void CEx125View::OnDraw(CDC* pDC)
- {
- CEx125Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx125View printing
- BOOL CEx125View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CEx125View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CEx125View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx125View diagnostics
- #ifdef _DEBUG
- void CEx125View::AssertValid() const
- {
- CView::AssertValid();
- }
- void CEx125View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CEx125Doc* CEx125View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx125Doc)));
- return (CEx125Doc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEx125View message handlers
- void CEx125View::OnFileOpen()
- {
- CString filename;
- //利用通用对话框打开一个AVI文件
- static char szFilter[]="AVI文件(*.avi)|*.avi||";
- CFileDialog dlg(TRUE,"avi",NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,szFilter);
- if(dlg.DoModal()==IDOK)
- {
- filename=dlg.GetPathName();//得到选择的文件名
- //如果已经有一个MCIWnd窗口,则将其关闭
- if(m_hwndMCIWnd!=NULL)
- MCIWndDestroy(m_hwndMCIWnd);
- //建立一个MCIWnd窗口
- m_hwndMCIWnd=MCIWndCreate(
- m_hWnd, //父窗口(视图窗口)的句柄
- AfxGetInstanceHandle(), //该实例的句柄
- 0, //标志
- filename); //文件名
- }
- }