Exemple #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);
        }
Exemple #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;
        }
Exemple #3
0
        public void RemoveNode(IntPtr hwnd)
        {
            WindowTreeNode node = (WindowTreeNode)hwndNodeMap[hwnd];

            if (node != null)
            {
                hwndNodeMap.Remove(hwnd);
                node.Remove();
            }
        }
Exemple #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();
        }
Exemple #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);
        }
Exemple #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);
                }
            }
        }
Exemple #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);
                }
            }
        }
Exemple #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();
 }
Exemple #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;
        }