【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,MCI_1View.cpp,希望对大家有所帮助!
// MCI_1View.cpp : implementation of the CMCI_1View class
//
#include "stdafx.h"
#include "MCI_1.h"
#include "MCI_1Doc.h"
#include "MCI_1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMCI_1View
IMPLEMENT_DYNCREATE(CMCI_1View, CView)
BEGIN_MESSAGE_MAP(CMCI_1View, CView)
//{{AFX_MSG_MAP(CMCI_1View)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CMCI_1View construction/destruction
CMCI_1View::CMCI_1View()
{
// TODO: add construction code here
m_hMyMCIWnd=NULL;
}
CMCI_1View::~CMCI_1View()
{
}
BOOL CMCI_1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMCI_1View drawing
void CMCI_1View::OnDraw(CDC* pDC)
{
CMCI_1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CMCI_1View printing
BOOL CMCI_1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMCI_1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMCI_1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMCI_1View diagnostics
#ifdef _DEBUG
void CMCI_1View::AssertValid() const
{
CView::AssertValid();
}
void CMCI_1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMCI_1Doc* CMCI_1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMCI_1Doc)));
return (CMCI_1Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMCI_1View message handlers
void CMCI_1View::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_hMyMCIWnd=MCIWndCreate(m_hWnd,AfxGetInstanceHandle(),MCIWNDF_NOTIFYSIZE|MCIWNDF_NOERRORDLG|
WS_CHILD|WS_VISIBLE,NULL); //创建一个MCI 窗口
if(m_hMyMCIWnd==NULL)return;
const CString &filename=GetDocument()->GetPathName();
// const CString filename="f:\\1.avi";
if(filename.GetLength()>0)
MCIWndOpen(m_hMyMCIWnd,(LPCTSTR)&filename,0);
}