Por que voce não captura a imagem, sem o controle:
Em um módulo:
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 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 ReleaseCapture Lib "user32" () As Long
Public Const WM_CAP_DRIVER_CONNECT As Long = 1034
Public Const WM_CAP_DRIVER_DISCONNECT As Long = 1035
Public Const WM_CAP_GRAB_FRAME As Long = 1084
Public Const WM_CAP_EDIT_COPY As Long = 1054
Public Const WM_CAP_DLG_VIDEOFORMAT As Long = 1065
Public Const WM_CAP_DLG_VIDEOSOURCE As Long = 1066
Public Const WM_CLOSE = &H10
Public mCapHwnd As Long
No formulário, coloque um timer com Interval = 100
Uma Picture :
No Form_Load
Inicia a câmera
SendMessage mCapHwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0
mCapHwnd = capCreateCaptureWindow("My Own Capture Window", 0, 0, 0, 320, 240, Me.Hwnd, 0)
'mCapHwnd = capCreateCaptureWindow("My Own Capture Window", 0, 0, 0, 3, 4, Me.hwnd, 0)
SendMessage mCapHwnd, WM_CAP_DRIVER_CONNECT, 0, 0
No Timer:
Private Sub Timer1_Timer()
'Captura a imagem atual
Clipboard.Clear
SendMessage mCapHwnd, WM_CAP_GRAB_FRAME, 0, 0
SendMessage mCapHwnd, WM_CAP_EDIT_COPY, 0, 0
Picture1.Picture = Clipboard.GetData()
End Sub
Botão Ligar a cam
Private Sub cmdLIGAR_Click()
Clipboard.Clear
SendMessage mCapHwnd, WM_CAP_GRAB_FRAME, 0, 0
SendMessage mCapHwnd, WM_CAP_EDIT_COPY, 0, 0
Picture1.Picture = Clipboard.GetData()
End Sub
Botão desligar
Private Sub cmdDESLIGA_Click()
SendMessage mCapHwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0
End Sub
Sair do Form
Private Sub cmdSAIR_Click()
SendMessage mCapHwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0
Unload Me
Set Me = Nothing
End Sub
Com o Interval em 100 no Timer, a captura da imagem é continua.
vlu//