Exemple #1
0
        public WindowTreeNode(IntPtr hwnd)
        {
            this.hwnd = hwnd;
            string className = this.WindowClassName;
            IntPtr hProcess  = UnmanagedMethods.GetProcessHandleFromHwnd(hwnd);

            int size = Is64BitProcess(hProcess) ? 64 : 86;

            this.Text = String.Format("Window {0:X8} \"{1}\" {2} (x{3})", hwnd.ToInt32(), WindowText, className, size);

            if (IsDotNetWindow(className))
            {
                if (UnmanagedMethods.IsWindowVisible(hwnd))
                {
                    this.ImageIndex = (int)ImageIndices.ManagedWindow;
                }
                else
                {
                    this.ImageIndex = (int)ImageIndices.ManagedWindowHidden;
                }
            }
            else
            {
                if (UnmanagedMethods.IsWindowVisible(hwnd))
                {
                    this.ImageIndex = (int)ImageIndices.Window;
                }
                else
                {
                    this.ImageIndex = (int)ImageIndices.WindowHidden;
                }
            }

            this.SelectedImageIndex = this.ImageIndex;
        }
Exemple #2
0
        public WindowTreeNode(IntPtr hwnd)
        {
            this.hwnd = hwnd;
            string className = this.WindowClassName;

            this.Text = String.Format("Window {0:X8} \"{1}\" {2}", hwnd.ToInt32(), WindowText, className);

            if (IsDotNetWindow(className))
            {
                if (UnmanagedMethods.IsWindowVisible(hwnd))
                {
                    this.ImageIndex = (int)ImageIndices.ManagedWindow;
                }
                else
                {
                    this.ImageIndex = (int)ImageIndices.ManagedWindowHidden;
                }
            }
            else
            {
                if (UnmanagedMethods.IsWindowVisible(hwnd))
                {
                    this.ImageIndex = (int)ImageIndices.Window;
                }
                else
                {
                    this.ImageIndex = (int)ImageIndices.WindowHidden;
                }
            }

            this.SelectedImageIndex = this.ImageIndex;
        }