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)); }
internal static extern int ScreenToClient(System.IntPtr hWnd, ref LPPOINT lpPoint);