Ejemplo n.º 1
0
        public WindowTreeNode AddWindow(IntPtr hwnd)
        {
            WindowTreeNode node;

            if (!hwndNodeMap.ContainsKey(hwnd))
            {
                node = new WindowTreeNode(hwnd);
                IntPtr hwndParent = UnmanagedMethods.GetParent(hwnd);

                if (hwndParent == IntPtr.Zero)
                {
                    rootNode.Nodes.Add(node);
                }
                else
                {
                    WindowTreeNode parentNode = AddWindow(hwndParent);
                    parentNode.Nodes.Add(node);
                }

                hwndNodeMap[hwnd] = node;
            }
            else
            {
                node = (WindowTreeNode)hwndNodeMap[hwnd];
            }

            return(node);
        }
Ejemplo n.º 2
0
        public WindowTreeNode AddWindow(IntPtr hwnd)
        {
            WindowTreeNode node;

            if (!hwndNodeMap.ContainsKey(hwnd))
            {
                node = new WindowTreeNode(hwnd);
                IntPtr hwndParent = UnmanagedMethods.GetParent(hwnd);

                if (hwndParent == IntPtr.Zero)
                {
                    rootNode.Nodes.Add(node);
                }
                else
                {
                    WindowTreeNode parentNode = AddWindow(hwndParent);
                    parentNode.Nodes.Add(node);
                }

                hwndNodeMap[hwnd] = node;
            }
            else
            {
                node = (WindowTreeNode)hwndNodeMap[hwnd];
            }

            return node;
        }
Ejemplo n.º 3
0
        public void RemoveNode(IntPtr hwnd)
        {
            WindowTreeNode node = (WindowTreeNode)hwndNodeMap[hwnd];

            if (node != null)
            {
                hwndNodeMap.Remove(hwnd);
                node.Remove();
            }
        }
Ejemplo n.º 4
0
        private void details_Click(object sender, System.EventArgs e)
        {
            WindowTreeNode       node     = (WindowTreeNode)windowTree.SelectedNode;
            WindowPropertiesForm propForm = new WindowPropertiesForm();

            propForm.TargetWindowHandle = node.Hwnd;

            FormSizeSaver saver = new FormSizeSaver(propForm);

            propForm.ShowDialog();
        }
Ejemplo n.º 5
0
        public bool HasManagedChild(WindowTreeNode parentNode)
        {
            bool ret = false;

            foreach (WindowTreeNode node in parentNode.Nodes)
            {
                if (node.IsManaged || HasManagedChild(node))
                {
                    ret = true;
                    break;
                }
            }

            return(ret);
        }
Ejemplo n.º 6
0
        public void FilterUnmanagedWindows(WindowTreeNode parentNode)
        {
            for (int i = 0; i < parentNode.Nodes.Count; i++)
            {
                WindowTreeNode node = (WindowTreeNode)parentNode.Nodes[i];

                if (!node.IsManaged && !HasManagedChild(node))
                {
                    parentNode.Nodes.RemoveAt(i);
                    i--;
                }
                else
                {
                    FilterUnmanagedWindows(node);
                }
            }
        }
Ejemplo n.º 7
0
        public void FilterUnmanagedWindows(WindowTreeNode parentNode)
        {
            for(int i = 0; i < parentNode.Nodes.Count; i++)
            {
                WindowTreeNode node = (WindowTreeNode)parentNode.Nodes[i];

                if (!node.IsManaged && !HasManagedChild(node))
                {
                    parentNode.Nodes.RemoveAt(i);
                    i--;
                }
                else
                {
                    FilterUnmanagedWindows(node);
                }
            }
        }
Ejemplo n.º 8
0
 public void Expand()
 {
     if (previousWindowTreeBuilder != null)
     {
         foreach (DictionaryEntry entry in previousWindowTreeBuilder.hwndNodeMap)
         {
             if (hwndNodeMap.ContainsKey(entry.Key))
             {
                 WindowTreeNode oldWindowTreeNode = (WindowTreeNode)entry.Value;
                 if (oldWindowTreeNode.IsExpanded)
                 {
                     WindowTreeNode newWindowTreeNode = (WindowTreeNode)hwndNodeMap[entry.Key];
                     newWindowTreeNode.Expand();
                 }
             }
         }
     }
     RootNode.Expand();
 }
Ejemplo n.º 9
0
        public bool HasManagedChild(WindowTreeNode parentNode)
        {
            bool ret = false;

            foreach(WindowTreeNode node in parentNode.Nodes)
            {
                if (node.IsManaged || HasManagedChild(node))
                {
                    ret = true;
                    break;
                }
            }

            return ret;
        }