public void Stop() { try { this.bStopped = true; this.timer1.Stop(); Application.DoEvents(); WebCamCapture.SendMessage(this.mCapHwnd, 1035U, 0, 0); } catch (Exception ex) { } }
public void Start(ulong FrameNum) { try { this.Stop(); this.mCapHwnd = WebCamCapture.capCreateCaptureWindowA("WebCap", 0, 0, 0, this.m_Width, this.m_Height, this.Handle.ToInt32(), 0); Application.DoEvents(); WebCamCapture.SendMessage(this.mCapHwnd, 1034U, 0, 0); WebCamCapture.SendMessage(this.mCapHwnd, 1074U, 0, 0); this.m_FrameNumber = FrameNum; this.timer1.Interval = this.m_TimeToCapture_milliseconds; this.bStopped = false; this.timer1.Start(); } catch (Exception ex) { int num = (int)MessageBox.Show("An error ocurred while starting the video capture. Check that your webcamera is connected properly and turned on.\r\n\n" + ex.Message); this.Stop(); } }