Just I need to make sure of something but I'll tell you to work with multithreading without using BackgroundWorker component
Thread thrd;
Extract_ButtonHandler_Click(object sender, EventArgs e)
{
thrd = new Thread(new ThreadStart(ExtractFrames));
}
string outPath = "you path";
///Extracts frames and saves them in directory
void ExtractFrames()
{
foreach (FrameGrabber.Frame f in fg)//error in this line highlighting "in"
{
using (f)
{
picBoxFrame.Image = (Bitmap)f.Image.Clone();
f.Image.Save(System.IO.Path.Combine(outPath, "frame" + f.FrameIndex + ".bmp"), System.Drawing.Imaging.ImageFormat.Bmp);
//Application.DoEvents();
}
}
Cancel_ButtonHandler_Click(object sender, EventArgs e)
{
thrd.Suspend();
}
Try above code and tell me if you got an error, you may need to customize the code but I expect you'll understand the idea.