예제 #1
0
        /// <summary>
        /// 抓取前台模式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameWindow_Desktop_button_Click(object sender, EventArgs e)
        {
            GlobalObject.GameHandle = new GameHandleClass();
            int   SH = Screen.PrimaryScreen.Bounds.Height; //屏幕分辨率高度
            int   SW = Screen.PrimaryScreen.Bounds.Width;  //屏幕分辨率宽度
            Point xy = new Point();

            using (var bmp = FunctionBitmap.CopyWindow())
            {
                if (FunctionJudge.IsGameInWin(bmp, out xy))
                {
                    GlobalObject.GameHandle                   = new GameHandleClass();
                    GlobalObject.GameHandle.Handle            = IntPtr.Zero;
                    GlobalObject.GameHandle.Mode              = FunctionHandle.MODE.Desktop;
                    GlobalObject.GameHandle.XY                = xy;
                    this.GameWindow_Message_textBox.Text      = "前台模式抓取成功";
                    this.GameWindow_Message_textBox.BackColor = Color.Lime;
                    RefreshGameWindow_pictureBox();
                }
                else
                {
                    GlobalObject.GameHandle = new GameHandleClass();
                    this.GameWindow_Message_textBox.Text      = "前台模式抓取失败";
                    this.GameWindow_Message_textBox.BackColor = Color.Red;
                    RefreshGameWindow_pictureBox();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Chorme指定句柄模式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameWindow_Handle_button_Click(object sender, EventArgs e)
        {
            GameWindow_IsHandleClick = true;
            using (GameHandleClass SeekHandle = new GameHandleClass())
            {
                try
                {
                    this.GameWindow_InputIntPtr_textBox.BackColor = Color.White;
                    var result = int.Parse(this.GameWindow_InputIntPtr_textBox.Text);
                    SeekHandle.Handle = new IntPtr(result);
                }
                catch (Exception)
                {
                    this.GameWindow_InputIntPtr_textBox.BackColor = Color.Red;
                }
                SeekHandle.Mode = FunctionHandle.MODE.Handle;

                Point xy = new Point();
                if (FunctionJudge.IsGameInWin(SeekHandle.GetGameBitmap(), out xy))
                {
                    GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                    {
                        Mode = FunctionHandle.MODE.Chorme,
                        XY   = xy
                    };
                    RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                    this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 chorme句柄:" + GlobalObject.GameHandle.Handle.ToString();
                    this.GameWindow_Message_textBox.BackColor = Color.Lime;
                    RefreshGameWindow_pictureBox();
                }
                else
                {
                    RefreshGameWindow_treeView(SeekHandle.Handle);
                    this.GameWindow_Message_textBox.Text      = "后台模式抓取失败 句柄:" + SeekHandle.Handle.ToString();
                    this.GameWindow_Message_textBox.BackColor = Color.Red;
                    GlobalObject.GameHandle = new GameHandleClass();
                    RefreshGameWindow_pictureBox();
                }
            }
        }
예제 #3
0
 /// <summary>
 /// 手动后台模式
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GameWindow_treeView_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar != 13)
     {
         return;
     }
     else
     {
         //指定窗口句柄查找游戏窗口
         using (GameHandleClass SeekHandle = new GameHandleClass())
         {
             SeekHandle.Handle = (IntPtr)Convert.ToInt32(GameWindow_HandleList_treeView.SelectedNode.Text);
             SeekHandle.Mode   = FunctionHandle.MODE.Handle;
             Point xy = new Point();
             if (FunctionJudge.IsGameInWin(SeekHandle.GetGameBitmap(), out xy))
             {
                 GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                 {
                     Mode = FunctionHandle.MODE.Chorme,
                     XY   = xy
                 };
                 RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                 this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 chorme句柄:" + GlobalObject.GameHandle.Handle.ToString();
                 this.GameWindow_Message_textBox.BackColor = Color.Lime;
                 RefreshGameWindow_pictureBox();
             }
             else
             {
                 RefreshGameWindow_treeView(SeekHandle.Handle);
                 this.GameWindow_Message_textBox.Text      = "后台模式抓取失败 句柄:" + SeekHandle.Handle.ToString();
                 this.GameWindow_Message_textBox.BackColor = Color.Red;
                 GlobalObject.GameHandle = new GameHandleClass();
                 RefreshGameWindow_pictureBox();
             }
         }
     }
 }
예제 #4
0
        /// <summary>
        /// Chorme后台模式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameWindow_Handle_button_MouseCaptureChanged(object sender, EventArgs e)
        {
            if (GameWindow_IsHandleClick)
            {
                GameWindow_IsHandleClick = false;
                return;
            }
            //手动查找游戏句柄
            using (GameHandleClass SeekHandle = new GameHandleClass())
            {
                SeekHandle.Handle = FunctionHandle.GetMouseHandle();
                SeekHandle.Mode   = FunctionHandle.MODE.Handle;

                if (SeekHandle.IsWin_800x480())
                {
                    GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                    {
                        Mode = FunctionHandle.MODE.Handle
                    };
                    RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                    this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 句柄:" + GlobalObject.GameHandle.Handle.ToString();
                    this.GameWindow_Message_textBox.BackColor = Color.Lime;
                    RefreshGameWindow_pictureBox();
                    return;
                }
                else//chorme模式
                {
                    SeekHandle.Mode = FunctionHandle.MODE.Handle;
                    Point xy = new Point();
                    if (FunctionJudge.IsGameInWin(SeekHandle.GetGameBitmap(), out xy))
                    {
                        GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                        {
                            Mode = FunctionHandle.MODE.Chorme,
                            XY   = xy
                        };
                        RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                        this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 chorme句柄:" + GlobalObject.GameHandle.Handle.ToString();
                        this.GameWindow_Message_textBox.BackColor = Color.Lime;
                        RefreshGameWindow_pictureBox();
                    }
                    else
                    {
                        // 尝试根父句柄的抓取
                        SeekHandle.Handle = FunctionHandle.GetTopFatherHandle(SeekHandle.Handle);
                        SeekHandle.Mode   = FunctionHandle.MODE.Handle;

                        if (FunctionJudge.IsGameInWin(SeekHandle.GetGameBitmap(), out xy))
                        {
                            GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                            {
                                Mode = FunctionHandle.MODE.Chorme,
                                XY   = xy
                            };
                            RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                            this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 chorme句柄:" + GlobalObject.GameHandle.Handle.ToString();
                            this.GameWindow_Message_textBox.BackColor = Color.Lime;
                            RefreshGameWindow_pictureBox();
                        }
                        else
                        {
                            RefreshGameWindow_treeView(SeekHandle.Handle);
                            this.GameWindow_Message_textBox.Text      = "后台模式抓取失败 句柄:" + SeekHandle.Handle.ToString();
                            this.GameWindow_Message_textBox.BackColor = Color.Red;
                            GlobalObject.GameHandle = new GameHandleClass();
                            RefreshGameWindow_pictureBox();
                        }
                    }
                }
            }
        }