Modulo------ ModWebcam
Public Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hwndParent As Long, ByVal nID As Long) As Long
Public mCapHwnd As Long
Public Const CONNECT As Long = 1034
Public Const DISCONNECT As Long = 1035
Public Const GET_FRAME As Long = 1084
Public Const COPY As Long = 1054
------------------------------------------------
Resto de codigo
--------------------
Private Sub cmdStart_Click()
cmdStart.Enabled = False
cmdStop.Enabled = True
mCapHwnd = capCreateCaptureWindow("WebcamCapture", 0, 0, 0, 320, 240, Me.hwnd, 0)
DoEvents: SendMessage mCapHwnd, CONNECT, 0, 0
tmrMain.Enabled = True
End Sub
Private Sub cmdStop_Click()
cmdStart.Enabled = True
cmdStop.Enabled = False
tmrMain.Enabled = False
DoEvents: SendMessage mCapHwnd, DISCONNECT, 0, 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If cmdStop.Enabled = False Then
DoEvents: SendMessage mCapHwnd, DISCONNECT, 0, 0
End If
End Sub
Private Sub tmrMain_Timer()
On Error Resume Next
SendMessage mCapHwnd, GET_FRAME, 0, 0
SendMessage mCapHwnd, COPY, 0, 0
picOutput.Picture = Clipboard.GetData
Clipboard.Clear
End Sub
'' Espero que sea de utilidad y orientacion
Public Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hwndParent As Long, ByVal nID As Long) As Long
Public mCapHwnd As Long
Public Const CONNECT As Long = 1034
Public Const DISCONNECT As Long = 1035
Public Const GET_FRAME As Long = 1084
Public Const COPY As Long = 1054
------------------------------------------------
Resto de codigo
--------------------
Private Sub cmdStart_Click()
cmdStart.Enabled = False
cmdStop.Enabled = True
mCapHwnd = capCreateCaptureWindow("WebcamCapture", 0, 0, 0, 320, 240, Me.hwnd, 0)
DoEvents: SendMessage mCapHwnd, CONNECT, 0, 0
tmrMain.Enabled = True
End Sub
Private Sub cmdStop_Click()
cmdStart.Enabled = True
cmdStop.Enabled = False
tmrMain.Enabled = False
DoEvents: SendMessage mCapHwnd, DISCONNECT, 0, 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If cmdStop.Enabled = False Then
DoEvents: SendMessage mCapHwnd, DISCONNECT, 0, 0
End If
End Sub
Private Sub tmrMain_Timer()
On Error Resume Next
SendMessage mCapHwnd, GET_FRAME, 0, 0
SendMessage mCapHwnd, COPY, 0, 0
picOutput.Picture = Clipboard.GetData
Clipboard.Clear
End Sub
'' Espero que sea de utilidad y orientacion