I have written some code that should display a video captured from a webcam in a PictureBox. I would like to record and save the displayed video in .avi format. Is there any way to do so?
The code I have tried for recording the video is:
Dim hWnd As Long
hWnd = capCreateCaptureWindow(0, ws_visible Or ws_child, 0, 0, 0, 0, tgt.hWnd, 0)
Dim a As Boolean
a = SendMessage(hWnd, wm_cap_driver_connect, 0, 0)
a = SendMessage(hWnd, WM_CAP_SET_SCALE, True, 0)
a = SendMessage(hWnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0)
a = SendMessage(hWnd, WM_CAP_FILE_SET_CAPTURE_FILE, "d:\myvideo1.avi", 0)
a = SendMessage(hWnd, WM_CAP_SET_SEQUENCE_SETUP, 96, 0)
a = SendMessage(hWnd, WM_CAP_SEQUENCE, 0, 0)
However, it gives a "Type Mismatch" error for the following line:
a = SendMessage(hWnd, WM_CAP_FILE_SET_CAPTURE_FILE, "d:\myvideo1.avi", 0)
Any ideas?