Public Sub callCam() PictureBox1.SizeMode = PictureBoxSizeMode.Zoom fiF = New FilterInfoCollection(FilterCategory.VideoInputDevice) finalVideo = New VideoCaptureDevice(fiF(0).MonikerString) finalVideo.VideoResolution = finalVideo.VideoCapabilities(0) AddHandler finalVideo.NewFrame, New NewFrameEventHandler(AddressOf Scapture) finalVideo.Start() End Sub Private Sub Scapture(ByVal sender As Object, ByVal eventArgs As NewFrameEventArgs) If ButtonVIDEO.BackColor = Color.Black Then 'In case of Preview only (No recording) Try BMP = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'Put the data in the bitmap PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'present it in the Picture Box Catch ex As Exception MsgBox(ex.Message) End Try Else ' In case of Recording Try BMP = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'Put the data in the bitmap PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(), Bitmap) 'present it in the Picture Box VFwriter.WriteVideoFrame(BMP) 'Save in Memory Catch ex As Exception MsgBox(ex.Message) End Try End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)