Binarysharp.MemoryManagement.Windows.WindowCore.EnumChildWindows C# (CSharp) Method

EnumChildWindows() public static method

Enumerates recursively all the child windows that belong to the specified parent window.
public static EnumChildWindows ( IntPtr parentHandle ) : IEnumerable
parentHandle System.IntPtr The parent window handle.
return IEnumerable
        public static IEnumerable<IntPtr> EnumChildWindows(IntPtr parentHandle)
        {
            // Create the list of windows
            var list = new List<IntPtr>();
            // Create the callback
            EnumWindowsProc callback = delegate(IntPtr windowHandle, IntPtr lParam)
            {
                list.Add(windowHandle);
                return true;
            };
            // Enumerate all windows
            NativeMethods.EnumChildWindows(parentHandle, callback, IntPtr.Zero);

            // Returns the list of the windows
            return list.ToArray();
        }