void SendMouse(IntPtr hWnd, IContact contact, Action<IntPtr, POINT> action) { POINT point = new POINT((int)contact.X, (int)contact.Y); if(hWnd.Equals(IntPtr.Zero)) hWnd = GetWindowAtPoint(point); NativeMethods.MapWindowPoints(IntPtr.Zero, hWnd, ref point, 1); if(hWnd != IntPtr.Zero) action(hWnd, point); }
IntPtr GetWindowAtPoint(POINT point) { return NativeMethods.WindowFromPoint(point); }