mfcdoc.cpp

来自「利用opencv在mfc下实现视频的播放」· C++ 代码 · 共 101 行

CPP
101
字号
// mfcDoc.cpp : implementation of the CMfcDoc class
//

#include "stdafx.h"
#include "mfc.h"

#include "mfcDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMfcDoc

IMPLEMENT_DYNCREATE(CMfcDoc, CDocument)

BEGIN_MESSAGE_MAP(CMfcDoc, CDocument)
	//{{AFX_MSG_MAP(CMfcDoc)
	ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMfcDoc construction/destruction

CMfcDoc::CMfcDoc()
{
	// TODO: add one-time construction code here

}

CMfcDoc::~CMfcDoc()
{
}

BOOL CMfcDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CMfcDoc serialization

void CMfcDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CMfcDoc diagnostics

#ifdef _DEBUG
void CMfcDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CMfcDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMfcDoc commands

void CMfcDoc::OnFileOpen() 
{
	// TODO: Add your command handler code here
	CFileDialog fileOpenDlg(TRUE, "avi", "*.*", NULL, "avi Files(*.*)", NULL);
	int nRespond = fileOpenDlg.DoModal();
	if(nRespond == IDOK)
	{
		filePath = fileOpenDlg.GetPathName();
		capture=cvCaptureFromFile(filePath);
		if(filePath)
			SetTitle(filePath);
		else
			DeleteContents();
	}
	UpdateAllViews(0);	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?