22 | 02 | 2017

List of Webcams

Code below displays a list of all webcams connected into a listbox.

List of webcams.net



Public Class Form1

'To make this code work make sure you have a button called btnGetDevices and a listbox called lstCams

Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, _
ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, _
ByVal cbVer As Integer) As Boolean

Private Sub LoadCams()
Dim strName As String = Space(100)
Dim strVer As String = Space(100)
Dim bReturn As Boolean
Dim x As Integer = 0

' Load name of all avialable devices into the lstcams .

' Get Driver name and version
bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
' If there was a device add device name to the list
If bReturn Then lstcams.Items.Add(strName.Trim)
x += 1
Loop Until bReturn = False
End Sub

Private Sub btnGetDevices_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetDevices.Click
End Sub
End Class

Sign up now and upload your code to the website.

Help us to continue.....
Articles View Hits
Latest Articles