Example #1
0
        /// <summary>
        /// 鼠标点击事件
        /// </summary>
        void Hook_OnMouseActivity(object sender, MouseEventArgs e)
        {
            SelectedHwnd = FindWindowInfo.GetWindowHWND(e.X, e.Y);
            string gameName = FindWindowInfo.GetWindowName(SelectedHwnd);
            int    pid      = FindWindowInfo.GetProcessIDByHWND(SelectedHwnd);

            if (Process.GetCurrentProcess().Id != pid)
            {
                ProcessInfoLabel.Text = "[实时]" + gameName + "—" + pid;
            }
            hook.Stop();
            WindowChooseBtn.BtnText = "选择窗口";
        }
Example #2
0
        /// <summary>
        /// 鼠标点击事件
        /// </summary>
        void Hook_OnMouseActivity(object sender, MouseEventArgs e)
        {
            int    hwnd     = FindWindowInfo.GetWindowHWND(e.X, e.Y);
            string gameName = FindWindowInfo.GetWindowName(hwnd);
            int    pid      = FindWindowInfo.GetProcessIDByHWND(hwnd);

            if (Process.GetCurrentProcess().Id != pid)
            {
                ProcessInfoLabel.Text = "[实时]" + gameName + "—" + pid;

                bool flag = false;
                for (int i = 0; i < processList.Count; i++)
                {
                    KeyValuePair <string, string> pkvp = processList[i];
                    if (pkvp.Key == pid.ToString())
                    {
                        SystemProcessCombox.SelectedIndex = i;
                        flag = true;
                        break;
                    }
                }

                if (flag == false)
                {
                    //打开这个窗口后再打开游戏的情况
                    ReNewSystemProcessCombox();
                    for (int i = 0; i < processList.Count; i++)
                    {
                        KeyValuePair <string, string> pkvp = processList[i];
                        if (pkvp.Key == pid.ToString())
                        {
                            SystemProcessCombox.SelectedIndex = i;
                            flag = true;
                            break;
                        }
                    }
                }

                gamePID = pid;

                hook.Stop();
                SelectGameWindowBtn.BtnText = "选择窗口";
            }
        }