www.pudn.com > vc-network-communication.rar > VideoCapture.cpp


//NetTalk 
/*------------------------------------------------------------------------------*\ 
 ============================= 
   模块名称: VideoCapture.cpp 
 ============================= 
  
 [版权] 
  
   2000-2002  115软件工厂  版权所有 
                                               
\*------------------------------------------------------------------------------*/ 
#include "WndX.h" 
#include  
#include "VideoCapture.h" 
 
#include "AVIOMgr.h" 
 
#pragma comment(lib,"vfw32") 
 
/*------------------------------------------------------------------------------*/ 
 
CVideoCapture::CVideoCapture() 
 
{ 
	 
	m_hWndCap = NULL; 
	 
	 
	 
} 
/*------------------------------------------------------------------------------*/ 
CVideoCapture::~CVideoCapture() 
{ 
	Destroy(); 
} 
/*------------------------------------------------------------------------------*/ 
BOOL CVideoCapture::Init() 
{ 
	 
	BOOL bRet = FALSE; 
	int i;	 
	Destroy();	 
	 
	m_hWndCap=capCreateCaptureWindow(0,0,0,0,0,0,0,0); 
	if(!m_hWndCap) 
		goto RET; 
	for(i=0;i=MAX_VFW_DEVICES) 
	{ 
	 
		goto RET; 
	} 
	 
	 
	if (m_hWndCap==NULL||m_DriverIndex[DriverIndex]==-1) 
		goto RET; 
	capCaptureAbort(m_hWndCap); 
		 
	if(!capDriverConnect(m_hWndCap, m_DriverIndex[DriverIndex])) 
		goto RET; 
			 
	 
	capCaptureGetSetup(m_hWndCap,&CapParms,sizeof(CapParms)); 
	CapParms.vKeyAbort=0; 
	CapParms.fAbortLeftMouse = FALSE; 
	CapParms.fAbortRightMouse = FALSE; 
	CapParms.fYield = TRUE; 
	CapParms.fCaptureAudio=FALSE; 
	CapParms.wPercentDropForError = 100; 
	capCaptureSetSetup(m_hWndCap,&CapParms,sizeof(CapParms));	 
	bRet=TRUE; 
RET: 
	 
	return bRet; 
} 
 
 
/*------------------------------------------------------------------------------*/ 
 
 
//得到设备数 
int CVideoCapture::GetDriverNum() 
{ 
	int iDriverNum=0; 
	char    achDeviceVersion[80] ; 
    char    achDeviceAndVersion[160] ; 
	for(int i=0;i