List Available Devices Short source code snippet that illustrates how to list all video capture devices that are installed on a system and available to IC Imaging Control.
Language: | .NET C#/Visual Basic
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 | List Devices - C#

The functionality to list all video capture devices installed on a system is provided by the collection ICImagingControl.Devices . First of all, a listbox is dragged onto the form and labeled listBox1. The listbox is used to list all available video capture devices. To add the names of the video capture devices available on the system to the listbox, it's DataSource simply has to be set to icImagingControl1.Devices.

    C#

    private void Form1_Load(object sender, System.EventArgs e)
    {
        // Resize the live video display to ICImagingControl's size,
        // so the complete image is displayed resized.
        icImagingControl1.LiveDisplayDefault = false;
        icImagingControl1.LiveDisplayHeight = icImagingControl1.Height;
        icImagingControl1.LiveDisplayWidth = icImagingControl1.Width;

        // Query the available devices.
        listBox1.DataSource = icImagingControl1.Devices ;
    }

Selecting a video capture device and starting the live video is simple:

    C#

    private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        if (icImagingControl1.LiveVideoRunning)
            icImagingControl1.LiveStop();
        icImagingControl1.Device = listBox1.SelectedItem.ToString();
        icImagingControl1.LiveStart();
    }