Exemplo n.º 1
0
        private void StartRunning()
        {
            if (!SetParameters())
            {
                ShowErrorMessage("Failed to set parameters.");
                return;
            }

            try
            {
                Process[] processes = Process.GetProcessesByName(m_process_name);
                m_process_whnd = processes[0].MainWindowHandle;
            }
            catch (Exception)
            {
                ShowErrorMessage("Failed to get the window handle of Bejeweled.");
                return;
            }

            Win32Helper.BringWindowToTop(this.Handle);
            //Win32Helper.SetForegroundWindow(this.Handle);

            m_running = true;
            m_timer.Start();
            statusBar.Text = "Running under " + m_matcher.Mode.ToString() + " mode";
        }
Exemplo n.º 2
0
        public static Bitmap CaptureWindow(IntPtr hWnd)
        {
            if (!Win32Helper.BringWindowToTop(hWnd))
            {
                return(null);
            }

            if (!Win32Helper.SetForegroundWindow(hWnd))
            {
                return(null);
            }

            return(CaptureHandle(hWnd));
        }
Exemplo n.º 3
0
 private void ShowErrorMessage(string message)
 {
     Win32Helper.BringWindowToTop(this.Handle);
     Win32Helper.SetForegroundWindow(this.Handle);
     MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }