Capturing a webcam to an AVI file
SendMessage(lwndC, WM_CAP_FILE_SAVEDIB, 0&, filename)
End Sub
Where WM_CAP_FILE_SAVEDIB is defined as WM_USER+25
– It also requires an overloaded SendMessage declaration, which accepts a string as it’s final parameter.
I then found some CS code which converts BMP files to AVI (http://midget3d.com/gabe/AviLib.zip)
then used this to write bitmaps to disk, and build them into an AVI
saveFileDialog.Filter="*.avi|*.avi";
saveFileDialog.ShowDialog();
string strAVI = saveFileDialog.FileName;
string strBMP = saveFileDialog.FileName.Replace(".avi",".bmp");
AviWriter aviWriter =
new AviWriter(strAVI, AviCompression.None, 24, 320, 240);
isRecording =
true;
while(isRecording)
{
webcamControl1.SaveBitmap(strBMP);
aviWriter.WriteFrame(
new Bitmap(strBMP));
Application.DoEvents();
}
aviWriter.Close();