¿Cómo detectar webcam?
Bueno en el programa que estoy haciendo me gustaría detectar si hay un webcam presente en el ordenador, para eso he intentado utilizar el siguiente código pero probándolo en mi ordenador he comprobado que sin tener webcam me dice que si y pone el picturebox en negro, ¿alguna idea de que puede estar mal o que otra cosa puedo hacer para saber si hay una webcam?
Gracias de antemano, noele1995
Const ws_child As Long = &H40000000
Const ws_visible As Long = &H10000000
Const WM_USER = 1024
Const wm_cap_driver_connect = WM_USER + 10
Const wm_cap_set_preview = WM_USER + 50
Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52
Const WM_CAP_DRIVER_DISCONNECT As Long = WM_USER + 11
Const WM_CAP_DLG_VIDEOFORMAT As Long = WM_USER + 41
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long
Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias
"capCreateCaptureWindowA" (ByVal a As String, ByVal b As Long, ByVal c
As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f As Integer,
ByVal g As Long, ByVal h As Integer) As Long
Dim hwdc As Long
Dim startcap As Boolean
Private Sub Command1_Click()
hwdc = capCreateCaptureWindow("Dixanta Vision System", ws_child Or ws_visible, 0, 0, 320, 240, Picture1.hWnd, 0)
If hwdc <> 0 Then
MsgBox "Se encontro un disposistivo Webcam"
Else
MsgBox "No se encontro ninguna Webcam"
End If
End Sub