16,551
社区成员
发帖
与我相关
我的任务
分享void CVedioTestDlg::StartVedio()
{
ghWndCap = capCreateCaptureWindow(//创建捕获窗口
L"Capture Window",
WS_CHILD|WS_VISIBLE,
0,0,
300,240,
this->m_hWnd,
(int)0);
capDriverConnect(ghWndCap,0); // 将捕获窗同驱动器连接
CAPTUREPARMS RetCAPTUREPARMS;
memset(&RetCAPTUREPARMS,0,sizeof(CAPTUREPARMS));
capCaptureGetSetup(ghWndCap,&RetCAPTUREPARMS,sizeof(CAPTUREPARMS));//获得当前状态
RetCAPTUREPARMS.fLimitEnabled = TRUE;//打开设置时间限制开关
RetCAPTUREPARMS.wTimeLimit = 5;//设置摄像时间,单位为秒
capCaptureSetSetup(ghWndCap,&RetCAPTUREPARMS,sizeof(CAPTUREPARMS));//重新设置状态
capPreviewRate(ghWndCap, 66); // 设置Preview模式的显示速率
capPreview(ghWndCap, TRUE); //启动Preview模式
capFileSetCaptureFile( ghWndCap, _T("Test.avi")); //指定捕获文件名
capFileAlloc(ghWndCap, (1024L * 1024L * 5)); //为捕获文件分配存储空间
capCaptureSequence(ghWndCap); //开始捕获视频序列
capGrabFrame(ghWndCap); //捕获单帧图像
}