Exemplo n.º 1
0
        public TreeNodeEx(NodeType nodetype, object info, bool hasChild)
        {
            this.b_ChildAdded = false;
            this.m_Type       = nodetype;
            //注意,两个属性都要进行设置!
            this.ImageIndex         = (int)nodetype;
            this.SelectedImageIndex = (int)nodetype;
            this.Tag = info;
            switch (this.m_Type)
            {
            case NodeType.Window:
                WndInfo wndinfo = (WndInfo)info;
                this.Text = string.Format("{0} \"{1}\"", wndinfo.WndClassName, wndinfo.Caption);
//						if (wndinfo.Caption.IndexOf("阿里旺旺")>=0)
//							MessageBox.Show(wndinfo.Caption);
                if (wndinfo.Caption.IndexOf("指定") >= 0)
                {
                    MessageBox.Show(wndinfo.Caption);
                }
                if (!wndinfo.IsVisible)
                {
                    this.ImageIndex--;
                    this.SelectedImageIndex--;
                }
                break;

            case NodeType.Process:
                //转化为"0x********"的16进制表示形式
                ProcessInfo proinfo = (ProcessInfo)info;
                this.Text = string.Format("PID:0x{0} {1}",
                                          Convert.ToString(proinfo.ID, 16).ToUpper().PadLeft(8, '0'),
                                          proinfo.ProcessName);
                break;

            case NodeType.Thread:
                //转化为"0x********"的16进制表示形式
                ThreadInfo thdinfo = (ThreadInfo)info;
                this.Text = "TID:0x" + Convert.ToString(thdinfo.ID, 16).ToUpper().PadLeft(8, '0');
                break;
            }
            if (hasChild)
            {
                this.Nodes.Add("TempNode");
            }
        }
Exemplo n.º 2
0
 //查找工具鼠标移动
 private void pbFindWnd_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (!this.b_FindingWnd)
     {
         return;
     }
     this.m_ScreenPoint      = this.pbFindWnd.PointToScreen(new Point(e.X, e.Y));
     this.m_POINT.X          = this.m_ScreenPoint.X;
     this.m_POINT.Y          = this.m_ScreenPoint.Y;
     this.LableMousePos.Text = string.Format("X:{0} Y:{1}",
                                             this.m_ScreenPoint.X,
                                             this.m_ScreenPoint.Y);
     this.m_HWND = MainFrm.WindowFromPoint(this.m_POINT);
     if (this.m_HWND != this.m_PreHWND)
     {
         if (this.m_HWND == 0)
         {
             //未找到窗口,清空显示内容
             this.cbWndClass.Text = string.Empty;
             this.tbWindowName.Clear();
             this.tbWndHandle.Clear();
         }
         else
         {
             //显示该窗口的信息
             this.m_WndInfo         = this.m_MainFrm.GetWndInfo(this.m_HWND);
             this.cbWndClass.Text   = this.m_WndInfo.WndClassName;
             this.tbWindowName.Text = this.m_WndInfo.Caption;
             this.tbWndHandle.Text  = Convert.ToString(this.m_WndInfo.hWnd, 16).PadLeft(8, '0');
             //高亮新找到的窗口
             this.m_MainFrm.HighLightWindow(this.m_HWND);
         }
         //再次高亮前一次的窗口(擦除效果)
         if (this.m_PreHWND > 0)
         {
             this.m_MainFrm.HighLightWindow(this.m_PreHWND);
         }
         //更新前一窗口到当前窗口
         this.m_PreHWND = this.m_HWND;
     }
 }