Opening and Handling Devices: 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.0.3
Released on:April 7, 2005
Author:IC Imaging Control Support Department
Requirements:IC Imaging Control >2.1
Camera, converter or grabber with WDM Stream Class drivers.

The sample application's window looks as follows:

The dialog window of the sample application.

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

Related Source Code Samples

Disclaimer
The source code that appears in the IC Imaging Control Source Code Library is indented for educational purposes only. The Imaging Source Europe GmbH, the manufacturer of IC Imaging Control, does not assume any kind of warranty expressed or implied, resulting from the use of the content of this page.

This site is part of The Imaging Source Network. Other sites include Company Portal, Image Processing, Astronomy Cameras, Astronomy Cameras Blog, Blog caméras d'astronomie, Astronomy Cameras Competition, TX Text Control, LiveDocx, phpLiveDocx and Forums.