예제 #1
0
        private void UpdateTimer_Tick(object sender, EventArgs e)
        {
            if (TopmostOnly && ExternalAPI.GetForegroundWindow() != WindowHandle)
            {
                return;
            }

            if (CapturePreview.Image != null)
            {
                CapturePreview.Image.Dispose();
            }

            CapturePreview.Image = ExternalAPI.CaptureWindow(WindowHandle, Method);
        }
예제 #2
0
파일: MainForm.cs 프로젝트: FoxCutter/Tools
        public void UpdateThread()
        {
            while (true)
            {
                if (SettingOptionsWindow.Visible)
                {
                    System.Threading.Thread.Sleep(SettingOptionsWindow.CaptureRate);
                }
                else
                {
                    System.Threading.Thread.Sleep(CaptureRate);
                }

                if (CaptureOptionsWindow.Visible)
                {
                    continue;
                }

                // Only look up the Window if we don't have one, or if the one we have is no longer a window or is hidden
                if (MatchWindowHandle == IntPtr.Zero || !ExternalAPI.IsWindow(MatchWindowHandle) || !ExternalAPI.IsWindowVisible(MatchWindowHandle))
                {
                    bool A = ExternalAPI.IsWindow(MatchWindowHandle);
                    bool B = ExternalAPI.IsWindowVisible(MatchWindowHandle);

                    MatchWindowHandle = FindWindow(WindowName, WindowTitle, MatchWindowTitle);
                }

                if (TopmostOnly && ExternalAPI.GetForegroundWindow() != MatchWindowHandle)
                {
                    continue;
                }

                Bitmap Image = null;
                if (MatchWindowHandle != IntPtr.Zero)
                {
                    Image = ExternalAPI.CaptureWindow(MatchWindowHandle, Method);
                }

                this.Invoke(UpdateCaptureCallback, Image);
            }
        }