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

📄 capturedevicedlg.cpp

📁 我近期从事视频开发所以将我参考的资料上传给大家看看。
💻 CPP
字号:
#include "stdafx.h"
#include "VidCap.h"
#include "CaptureDeviceDlg.h"
#include "VFWWnd.h"

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

CCaptureDeviceDlg::CCaptureDeviceDlg(CWnd* pParent)	: CDialog(CCaptureDeviceDlg::IDD, pParent),
                                                      m_wDeviceID(0)
{
	//{{AFX_DATA_INIT(CCaptureDeviceDlg)
	//}}AFX_DATA_INIT
}

void CCaptureDeviceDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCaptureDeviceDlg)
	DDX_Control(pDX, IDC_DEVICES, m_ctrlDevices);
	//}}AFX_DATA_MAP

  if (pDX->m_bSaveAndValidate)
  {
    int nIndex = m_ctrlDevices.GetCurSel();
    m_wDeviceID = static_cast<WORD>(m_ctrlDevices.GetItemData(nIndex));
  }
}

BEGIN_MESSAGE_MAP(CCaptureDeviceDlg, CDialog)
	//{{AFX_MSG_MAP(CCaptureDeviceDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CCaptureDeviceDlg::OnInitDialog() 
{
  //Let the parent class do its thing
	CDialog::OnInitDialog();

  //Add the capture devices to the list box
  for (WORD i=0; i<10; i++)
  {
    CString sName, sVersion;
    if (CAVICapWnd::GetDescription(i, sName, sVersion))
    {
      CString sText;
      if (sVersion.GetLength())
        sText.Format(_T("%s\t%s"), sName, sVersion);
      else
        sText = sName;
      int nIndex = m_ctrlDevices.AddString(sText);
      m_ctrlDevices.SetItemData(nIndex, i);
    }
  }

  //Now set the selection to the first item
  m_ctrlDevices.SetCurSel(0);
	
	return TRUE;
}

⌨️ 快捷键说明

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