AviCap.cpp
资源名称:停车场管理系统.zip [点击查看]
上传用户:trilite
上传日期:2007-04-24
资源大小:261k
文件大小:2k
源码类别:
酒店行业
开发平台:
Visual C++
- // AviCap.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ParkSys.h"
- #include "AviCap.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // AviCap
- CAviCap::CAviCap()
- {
- }
- CAviCap::~CAviCap()
- {
- }
- BOOL CAviCap::capInit(CWnd* pParentWnd, int tx, int ty,
- int bx, int by, int avi_WindowID,
- int DeviceIndex)
- {
- m_hWndCap = capCreateCaptureWindow((LPSTR)"Capture Window",
- WS_CHILD|WS_VISIBLE,
- tx,ty,bx,by,
- pParentWnd->GetSafeHwnd(), avi_WindowID);
- capDriverConnect(m_hWndCap, DeviceIndex);
- capOverlay (m_hWndCap, TRUE);
- if (m_hWndCap == NULL)
- return FALSE;
- //设置错误处理函数
- capSetCallbackOnError(m_hWndCap, CAviCap::ErrorCallbackProc);
- return TRUE;
- }
- void CAviCap::capClose()
- {
- capOverlay(m_hWndCap, 0);
- capDriverDisconnect(m_hWndCap);
- }
- /////////////////////////////////////////////////////////////////////////////
- // AviCap message handlers
- // ErrorCallbackProc: error callback function
- // hWnd: capture window handle
- // nErrID: error code for the encountered error
- // lpErrorText: error text string for the encountered error
- //
- LRESULT CAviCap::ErrorCallbackProc(HWND hWnd, int nErrID, LPSTR lpErrorText)
- {
- if (!hWnd)
- return FALSE;
- if (nErrID == 0) // Starting a new major function.
- return TRUE; // Clear out old errors.
- // Show the error identifier and text.
- CString strMsg;
- strMsg.Format("%s。错误号:%d", lpErrorText, nErrID);
- AfxMessageBox(strMsg, MB_OK | MB_ICONEXCLAMATION);
- return (LRESULT) TRUE;
- }