Opening and Handling Devices: Open Device

This programming example illustrates how to open a device in IC Imaging Control and display its live video stream on screen.
Language:Visual Basic 6
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.

This finished application looks as follows. The white square area underneath the "Open Device" button will be filled with the live video image.

The dialog window of the sample application.

Using the Devices collection, the application first of all lists the names of all video capture devices available on the system in the ListBox List1. .Devices.Count indicates the number of video capture devices found, while Devices(i) returns information about the i-th video capture device. In this case, the name of the video capture device.

Private Sub Form_Load()
    For i = 1 To ICImagingControl1.Devices.Count
        List1.AddItem ICImagingControl1.Devices(i).Name
    Next i
End Sub

Private Sub btnClose_Click()
    Unload Me
End Sub

When the button "Open Device" is clicked, the program stops the image data stream (.LiveStop) and retrieves the desired video capture device's name from List1.Text. Then, the video capture device's live image data stream is displayed, using .LiveStart:

Private Sub btnOpenDevice_Click()

    If ICImagingControl1.LiveVideoRunning Then
        ICImagingControl1.LiveStop
    End If

    ICImagingControl1.Device = List1.Text

    ICImagingControl1.LiveStart
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.