Open Multiple Devices This is a brief coding example that illustrates how to open multiple devices and display their live image data streams simultaneously.
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 | Open Multiple Devices - C#
Download VB7 sample | Open Multiple Devices - VB7

The sample application's window looks as follows:

First of all, two IC Imaging Controls are placed on the form - one for each camera. Additionally, there are two buttons for opening the video capture devices in each IC Imaging Control.

By clicking on one of the buttons, a probably running video capture device's image data stream of the accordant device is stopped (.LiveStop) and the build-in-dialog for device selection is displayed(.ShowDeviceSettingsDialog). If the selected video capture device is valid, the image data stream will be started using (.LiveStart)

The button handler source code of the first button looks as follows:

    C#

    private void buttonOpenDevice1_Click(object sender, System.EventArgs e)
    {
        if( icImagingControl1.LiveVideoRunning )
            icImagingControl1.LiveStop();

        icImagingControl1.ShowDeviceSettingsDialog();

        if( icImagingControl1.DeviceValid )
            icImagingControl1.LiveStart();
    }

    VB.NET

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If IcImagingControl1.LiveVideoRunning Then
            IcImagingControl1.LiveStop()
        End If

        IcImagingControl1.ShowDeviceSettingsDialog()

        If IcImagingControl1.DeviceValid Then
            IcImagingControl1.LiveStart()
        End If

    End Sub

The button handler source of the second button is similar:

    C#

    private void buttonOpenDevice2_Click(object sender, System.EventArgs e)
    {
        if( icImagingControl2.LiveVideoRunning )
            icImagingControl2.LiveStop();

        icImagingControl2.ShowDeviceSettingsDialog();

        if( icImagingControl2.DeviceValid )
            icImagingControl2.LiveStart();
    }

    VB.NET

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        If IcImagingControl2.LiveVideoRunning Then
            IcImagingControl2.LiveStop()
        End If

        IcImagingControl2.ShowDeviceSettingsDialog()

        If IcImagingControl2.DeviceValid Then
            IcImagingControl2.LiveStart()
        End If

    End Sub