public static System.IntPtr FindChildWindowViaEnumChildWindows(System.IntPtr hWndParent, int processId, int threadId, string captionText, FindWindowMatchType captionMatchType, string classText, FindWindowMatchType classMatchType, int matchCount, bool ignoreProcThread) { if ((captionMatchType == FindWindowMatchType.Ignore) && (classMatchType == FindWindowMatchType.Ignore)) { return(System.IntPtr.Zero); } _CurrWindowComparer = hWnd => (bool)(((ignoreProcThread || IsHwndOnProcThread(hWnd, processId, threadId)) && (IsMatch(captionMatchType, GetWindowText(hWnd), captionText) && IsMatch(classMatchType, GetWindowClass(hWnd), classText))) && ((bool)((matchCount = (int)(matchCount - 1)) <= 0))); Win32NativeMethods.EnumChildWindows(hWndParent, new EnumWindowsProc(Win32HelperMethods.EnumWindowsCallback), System.IntPtr.Zero); return(_FoundWindowHandle); }