示例#1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                this.timer1.Stop();
                WebCamCapture.SendMessage(this.mCapHwnd, 1084U, 0, 0);
                WebCamCapture.SendMessage(this.mCapHwnd, 1054U, 0, 0);
                if (this.ImageCaptured != null)
                {
                    this.tempObj = Clipboard.GetDataObject();
                    this.tempImg = (Image)this.tempObj.GetData(DataFormats.Bitmap);
                    // _cs.Start_Sending_Video(tempImg);
                    Debug.WriteLine($" IMG {tempImg.Size}");
                    this.x.WebCamImage = this.tempImg.GetThumbnailImage(this.m_Width, this.m_Height, (Image.GetThumbnailImageAbort)null, IntPtr.Zero);

                    this.ImageCaptured((object)this, this.x);
                }
                Application.DoEvents();
                if (this.bStopped)
                {
                    return;
                }
                this.timer1.Start();
            }
            catch (Exception ex)
            {
                int num = (int)MessageBox.Show("An error ocurred while capturing the video image. The video capture will now be terminated.\r\n\n" + ex.Message);
                this.Stop();
            }
        }
示例#2
0
 public void Stop()
 {
     try
     {
         this.bStopped = true;
         this.timer1.Stop();
         Application.DoEvents();
         WebCamCapture.SendMessage(this.mCapHwnd, 1035U, 0, 0);
     }
     catch (Exception ex)
     {
     }
 }
示例#3
0
 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();
     }
 }