Open a Video Capture Device This is a brief coding example that illustrates how to open an video capture device and display the live image data stream using Visual Studio™ C++.
Language: | Visual C++
Version: | 3.3
Author: | IC Imaging Control Support Department
Requirements: |
Software: | IC Imaging Control >3.3, Visual Studio™ 2010
Hardware: | Camera, converter or grabber with WDM Stream Class drivers.
Download C++ sample | Open Device

The sample application's window looks as follows:

First of all the instance of the Grabber class is to be created as member of the dialog class.

    DShowLib::Grabber        m_cGrabber; // The instance of the Grabber class.

The video capture device will be opened in the CDialog::OnInitDialog() method. Its device name string, e.g. "DBK 21F04" is passed to Grabber::openDev(). If the video capture device has been opened successfully, i.e. it is valid, the image data stream is started by a call to Grabber::startLive().

    m_cGrabber.openDev( "DFK 23UP031" );

    if( m_cGrabber.isDevValid())
            m_cGrabber.startLive();