public static System.IntPtr FindWindowByCaptionAndClassText(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))); return(FindWindowViaBfs(hWndParent)); }
public static System.IntPtr FindTopWindowViaEnumWindows(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.EnumWindows(new EnumWindowsProc(Win32HelperMethods.EnumWindowsCallback), System.IntPtr.Zero); return(_FoundWindowHandle); }
public static System.IntPtr FindWindowByPosition(System.IntPtr hWndParent, int processId, int threadId, int x, int y, bool ignoreProcThread) { _CurrWindowComparer = delegate(System.IntPtr hWnd) { LPPOINT lpPoint = new LPPOINT(); LPRECT lpRect = new LPRECT(); Win32NativeMethods.GetWindowRect(hWnd, ref lpRect); lpPoint.X = lpRect.Left; lpPoint.Y = lpRect.Top; Win32NativeMethods.ScreenToClient(hWndParent, ref lpPoint); return((bool)(((ignoreProcThread || IsHwndOnProcThread(hWnd, processId, threadId)) && ((int)lpPoint.X).Equals(x)) && ((int)lpPoint.Y).Equals(y))); }; return(FindWindowViaBfs(hWndParent)); }
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)); }