public static System.IntPtr FindWindowByControlId(System.IntPtr hWndParent, int processId, int threadId, int controlId, int matchCount, bool ignoreProcThread) { _CurrWindowComparer = hWnd => (bool)(((ignoreProcThread || IsHwndOnProcThread(hWnd, processId, threadId)) && ((Win32NativeMethods.GetDlgCtrlID(hWnd) == controlId) && (ignoreProcThread || IsHwndOnProcThread(hWnd, processId, threadId)))) && ((bool)((matchCount = (int)(matchCount - 1)) <= 0))); return(FindWindowViaBfs(hWndParent)); }