Capture Video from WebCam in VB.NET
Posted on 2006-11-05
I would like to capture video from a webcam in VB.Net. The following sourcecode displays the video correctly:
Private Sub cmdCapture_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdCapture.Click
Dim temp As Integer
hwdc = capCreateCaptureWindow("Dixanta Vision System", ws_child Or ws_visible, 0, 0, 320, 240, Picture1.Handle.ToInt32, 0)
If (hwdc <> 0) Then
temp = SendMessage(hwdc, wm_cap_driver_connect, 0, 0)
temp = SendMessage(hwdc, wm_cap_set_preview, 1, 0)
temp = SendMessage(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0)
startcap = True
MsgBox("No Webcam found")
I have added the code temp = SendMessage(hwdc, WM_CAP_SEQUENCE, 0, 0L)
This does create a video file - however there is no video, only sound.
Can you help me to get this snippet to work - or do you have other full source code that you can share?