Link to home
Start Free TrialLog in
Avatar of ErichN
ErichNFlag for Australia

asked on

Capture Video from WebCam in VB.NET

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
Else
   MsgBox("No Webcam found")
End If
End Sub

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?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ErichN

ASKER

Thank you Alex.  Your answer has helped me implementing my project.  As a small thankyou I have increased the points for you.