private static bool EnumChildWindowsCallback(IntPtr windowHandle, WindowFinderEnumChildWindowsProcContext context)
        {
            var classNameResult = MatchClassName(context, windowHandle);

            if (classNameResult == null)
            {
                return(true);
            }

            var windowTextResult = MatchWindowText(context, windowHandle);

            if (windowTextResult == null)
            {
                return(true);
            }

            var windowInformation = new WindowInformation(
                context.ParentWindow.ProcessID,
                windowHandle,
                classNameResult.Value,
                windowTextResult.Value,
                context.ParentWindow);

            if (classNameResult.IsMatch && windowTextResult.IsMatch)
            {
                context.Windows.Add(windowInformation);
            }

            return(true);
        }
        void IWin32WindowsNativeMethods.EnumChildWindows(
            IntPtr parentWindowHandle, EnumChildWindowsProc enumWindowsCallback, WindowFinderEnumChildWindowsProcContext context)
        {
            ArgumentUtility.CheckNotNull("enumWindowsCallback", enumWindowsCallback);
            ArgumentUtility.CheckNotNull("context", context);

            EnumChildWindows(parentWindowHandle, enumWindowsCallback, context);
        }
        private static void FindChildWindows(IntPtr windowHandle, WindowFinderEnumWindowsProcContext context, WindowInformation windowInformation)
        {
            var childWindowContext = new WindowFinderEnumChildWindowsProcContext(
                context.NativeMethods,
                context.ClassNameConstraint,
                context.WindowTextConstraint,
                windowInformation);

            context.NativeMethods.EnumChildWindows(windowHandle, EnumChildWindowsCallback, childWindowContext);
            context.Windows.AddRange(childWindowContext.Windows);
        }
 private static extern bool EnumChildWindows(IntPtr hwndParent, EnumChildWindowsProc lpEnumFunc, WindowFinderEnumChildWindowsProcContext data);