haithambradai / gong-wpf-dragdrop

Automatically exported from code.google.com/p/gong-wpf-dragdrop
0 stars 0 forks source link

Detecting cursor position #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This code helpswith errors, occured when draging from one window to another

public static class MousePositionHelper
  {
    private static class NativeMethods
    {
      [StructLayout(LayoutKind.Sequential)]
      public struct POINT
      {
        public int X;
        public int Y;
      }

      [DllImport("user32.dll")]
      public static extern bool GetCursorPos(out POINT lpPoint);
    }

    public static Point GetCursorPosition()
    {
      NativeMethods.POINT point;
      NativeMethods.GetCursorPos(out point);
      return new Point(point.X, point.Y);      
    }
  }

Original issue reported on code.google.com by ls.izhe...@gmail.com on 7 Jun 2013 at 10:42