Hi all,
I have an app where if you press a button, a dialog box pops up and gives you a choose of available webcams, screen resolution and inputs (see attached image). When I press start, my webcam shows automatically with the correct screen resolution but I need to press OK.
I want to be able to program the webcam to start at anytime which means I need a way to automatically press the OK button. The below code shows the function.
I have tried to remove the if statement so it bypasses the dialog box but I get a null exception error at the line
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
I thought it would make sense to set DialogResult.OK to true but that gives an error.
Does anyone know how to do this please? Thanks in advance.
I have an app where if you press a button, a dialog box pops up and gives you a choose of available webcams, screen resolution and inputs (see attached image). When I press start, my webcam shows automatically with the correct screen resolution but I need to press OK.
I want to be able to program the webcam to start at anytime which means I need a way to automatically press the OK button. The below code shows the function.
Code:
private void Start_Click(object sender, EventArgs e)
{
if (captureDevice.ShowDialog(this) == DialogResult.OK)
{
VideoCaptureDevice videoSource = captureDevice.VideoDevice;
FinalVideo = captureDevice.VideoDevice;
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
FinalVideo.Start();
}
}
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
I thought it would make sense to set DialogResult.OK to true but that gives an error.
Does anyone know how to do this please? Thanks in advance.
Attachments
-
57.1 KB Views: 4