In the following code the videCaptureDevice couldnt stop
videoCaptureDevice = new VideoCaptureDevice(filterInfoCollection[cboCamera.SelectedIndex].MonikerString);
videoCaptureDevice.NewFrame += VideoCaptureDevice_NewFrame;
videoCaptureDevice.Start();
videoCaptureDevice.Stop();
VideoCaptureDevice_NewFrame code is the following
private void VideoCaptureDevice_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
if (pic.InvokeRequired)
{
pic.Invoke(new MethodInvoker(() =>
{
pic.Image = (Bitmap)eventArgs.Frame.Clone();
}));
}
else
{
pic.Image = (Bitmap)eventArgs.Frame.Clone();
}
}
catch (Exception ex)
{
}
}
The exception is
System.PlatformNotSupportedException: 'Thread abort is not supported on this platform.'
Im using .NET 8 Windows Forms
New contributor
Pepito 22 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.