Exemplo n.º 1
0
        private void btnGetHwnd_MouseDown(object sender, MouseEventArgs e)
        {
            GetHwndInfor ghi = new GetHwndInfor();

            if (ghi.ShowDialog() == DialogResult.Yes)
            {
                _CurrentMousePointHwndInfo = ghi.HwndInfor;
                this.labHwendTitle.Text    = _CurrentMousePointHwndInfo.CurrentHwndTitle;
                this.txtHwndPath.Text      = string.Join("-", GetHwndPath(_CurrentMousePointHwndInfo.CurrentHwnd));
            }
        }
Exemplo n.º 2
0
        private void btnGetActiveLocation_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                if (this.ckbIsHidForm.Checked)
                {
                    this.Hide();
                }
                this.btnGetActiveLocation.Text = "获取位置中……";

                GetHwndInfor getHwnd = new GetHwndInfor();
                if (getHwnd.ShowDialog() == DialogResult.Yes)
                {
                    iActiveHwnd        = getHwnd.HwndInfor.CurrentHwnd;
                    this.txtHwnd.Text  = iActiveHwnd.ToString();
                    this.txtTitle.Text = string.Format("文本:{0}\r\n类名:{1}\r\n进程路径:{2}\r\n顶层窗体句柄:{3}\r\n鼠标位置:{4}\r\n组件距离顶层窗体的偏移量:{5}\r\n顶层窗体类名:{6}\r\n顶层窗体文本:{7}\r\n父窗体文本:{8}\r\n父窗体类名:{9}",
                                                       getHwnd.HwndInfor.CurrentHwndTitle, getHwnd.HwndInfor.CurrentHwndClassName, getHwnd.HwndInfor.HwndProcessPath, getHwnd.HwndInfor.TopFromHwnd, getHwnd.HwndInfor.MousePoint,
                                                       getHwnd.CalculationTopFormOffsetPoint(iActiveHwnd),
                                                       getHwnd.HwndInfor.TopFromClassName, getHwnd.HwndInfor.TopFromTitle,
                                                       getHwnd.HwndInfor.ParentTitle, getHwnd.HwndInfor.ParentClassName);

                    //getHwnd.TopFromTitle

                    this.btnGetActiveLocation.Text = "获取位置";
                }
                else
                {
                    this.btnGetActiveLocation.Text = "获取失败";
                }
                if (this.ckbIsHidForm.Checked)
                {
                    this.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "异常");
            }
        }