⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 motivecaptureview.cpp

📁 有关图像处理具有反色的功能运行没有问题很好用是我本页设计的内容
💻 CPP
字号:
// MotiveCaptureView.cpp : implementation of the CMotiveCaptureView class
//

#include "stdafx.h"
#include "MotiveCapture.h"

#include "MotiveCaptureDoc.h"
#include "MotiveCaptureView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMotiveCaptureView

IMPLEMENT_DYNCREATE(CMotiveCaptureView, CView)

BEGIN_MESSAGE_MAP(CMotiveCaptureView, CView)
	//{{AFX_MSG_MAP(CMotiveCaptureView)
	ON_COMMAND(ID_StarCap, OnStarCap)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMotiveCaptureView construction/destruction

CMotiveCaptureView::CMotiveCaptureView()
{
	// TODO: add construction code here

}

CMotiveCaptureView::~CMotiveCaptureView()
{
}

BOOL CMotiveCaptureView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMotiveCaptureView drawing

void CMotiveCaptureView::OnDraw(CDC* pDC)
{
	CMotiveCaptureDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CMotiveCaptureView printing

BOOL CMotiveCaptureView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMotiveCaptureView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMotiveCaptureView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMotiveCaptureView diagnostics

#ifdef _DEBUG
void CMotiveCaptureView::AssertValid() const
{
	CView::AssertValid();
}

void CMotiveCaptureView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMotiveCaptureDoc* CMotiveCaptureView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMotiveCaptureDoc)));
	return (CMotiveCaptureDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMotiveCaptureView message handlers

void CMotiveCaptureView::OnStarCap() 
{
	// TODO: Add your command handler code here
    m_bInit=FALSE;
    CWnd *pWnd=AfxGetMainWnd()->GetDlgItem(IDC_VIEW);
	pWnd->GetWindowRect(&rect);
  m_hCapWnd=capCreateCaptureWindow("CaptureTest",WS_CHILD|WS_VISIBLE|WS_EX_CLIENTEDGE|WS_EX_DLGMODALFRAME,0,0,rect.Width(),rect.Height(),pWnd->GetSafeHwnd(),(int)0);
	ASSERT(m_hCapWnd);
	if(capDriverConnect(m_hCapWnd,0))
	{
		m_bInit=TRUE;
		capDriverGetCaps(m_hCapWnd,&m_CapDrvCap,sizeof(CAPDRIVERCAPS));
		if(m_CapDrvCap.fCaptureInitialized)
		{
			capGetStatus(m_hCapWnd,&m_CapStatus,sizeof(m_CapStatus));
			capPreview(m_hCapWnd,TRUE);
		}
		else
		{
			AfxMessageBox("设备没有初始化!");
			AfxGetMainWnd()->PostMessage(WM_CLOSE);
		}
	}
	else
	{
		AfxMessageBox("设备没连接!");
		AfxGetMainWnd()->PostMessage(WM_CLOSE);
	}
	if(capPreview(m_hCapWnd,FALSE))
		capPreview(m_hCapWnd,TRUE);

	capCaptureGetSetup(m_hCapWnd,&m_Parms,sizeof(m_Parms));
    if(capCaptureGetSetup(m_hCapWnd,&m_Parms,sizeof(m_Parms))==TRUE)
	{}
	else
		AfxMessageBox("摄像头不能正常工作!请检查后,再试!");
	capCaptureSequence(m_hCapWnd);
}

⌨️ 快捷键说明

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