Usuario
conectar cuatro webcam a la vez con vb6

Pregunta
-
Hola a todos:
Tengo un programilla que consigue visualizar dos webcam a la vez, pero no se como conseguir visualizar cuatro.
Si alguien necesita el codigo que lo diga y lo pongo.
Gracias y un saludo.
- Cambiado Leandro TuttiniMVP lunes, 11 de febrero de 2013 20:07
Todas las respuestas
-
-
Gracias Javier J por contestar:
Mi codigo es este y lo que hago es repetirlos en varios formularios.
Option Explicit
Private Const WM_USER As Long = &H400
Private Const WM_CAP_DRIVER_CONNECT As Long = (WM_USER + &HA)
Private Const WM_CAP_DRIVER_DISCONNECT As Long = (WM_USER + &HB)
Private Const WM_CAP_SET_PREVIEWRATE As Long = (WM_USER + &H34)
Private Const WM_CAP_SET_PREVIEW As Long = (WM_USER + &H32)
Private Const WM_CAP_GET_STATUS As Long = (WM_USER + &H36)
Private Const HWND_TOP As Long = 0
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_NOENDCHANGING As Long = &H400
Private Const WM_CAP_START As Long = WM_USERPrivate Const WM_CAP_GET_MCI_DEVICEA As Long = (WM_CAP_START + 67)
Private Const WM_CAP_DLG_VIDEOSOURCE As Long = (WM_CAP_START + 42)
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As LongPrivate Declare Function SendMessage_2 Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As CAPSTATUS) As LongPrivate Declare Function SetWindowPos Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Sub Command1_Click()
Form2.ShowEnd Sub
Private Sub Form_Load()
Dim pCS As CAPSTATUS, ret As Long, mcistr As String
Dim res As Long, pich As Long
Timer1.Enabled = False
hCapWin = capCreateCaptureWindow("CaptureWindow", WS_CHILD Or WS_VISIBLE, 0, 0, 0, 0, Me.hWnd, 0)
If Not hCapWin = 0 Then
For res = 0 To 9 ret = SendMessage(hCapWin, WM_CAP_DRIVER_CONNECT, res, 0)
If ret = 1 Then Exit For
Next
If ret = 0 Then MsgBox "no webcam found", vbCritical: Exit Sub
SendMessage hCapWin, WM_CAP_DLG_VIDEOSOURCE, 0, 0 ' selecciona webcan SendMessage hCapWin, WM_CAP_SET_PREVIEWRATE, 66, 0
SendMessage hCapWin, WM_CAP_SET_PREVIEW, True, 0
SendMessage_2 hCapWin, WM_CAP_GET_STATUS, Len(pCS), pCS
w = pCS.uiImageWidth
h = pCS.uiImageHeight
SetWindowPos hCapWin, HWND_TOP, 0, 0, w, h, SWP_NOMOVE Or SWP_NOZORDER Or SWP_NOENDCHANGING
w = w + 10
h = h + 40
SetWindowPos Me.hWnd, HWND_TOP, 0, 0, w, h, SWP_NOMOVE Or SWP_NOZORDER Or SWP_NOENDCHANGING
End If
Form3.Show
End SubPrivate Sub Form_Terminate()
SendMessage hCapWin, WM_CAP_DRIVER_DISCONNECT, 0, 0
End Sub -
-
-
-
Me parece que el problema lo tienes en la creación de las ventanas en las que vas a mostrar los videos. En la página usa otra función.
Ten en cuenta que cada video tiene que trabajar sobre el controlador (handle) de la ventana que le corresponda.
Saludos, Javier J
-