title: Attempting to Simulate Mouse Click / Drag
body: <p>So I'm trying to simulate the left mouse click and the left mouse release to do some automated dragging and dropping.</p>
  
  <p>It's currently in a C# Winforms (Yes, winforms :|) and is being a bit of a goose.</p>
  
  <p>Basically, once a Click is sent, I want it to update the cursor position based upon the Kinect input. The Kinect side of things is fine but i'm not sure how to find if the button is still pressed or not.</p>
  
  <p>here's the code i'm currently using + some psuedocode to help better explain myself (the do while).</p>
  
  <pre><code>class MouseImpersonator
  {
      [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
      private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
  
      private const int leftDown = 0x02;
      private const int leftUp = 0x04;
  
      public static void Grab(int xPos, int yPos)
      {
          Cursor.Position = new Point(xPos + 25, yPos + 25);
          mouse_event(leftDown, (uint) xPos, (uint) yPos, 0, 0);
  
          //do
          //{
          //Cursor.Position = new Point(KinectSettings.movement.LeftHandX, KinectSettings.movement.LeftHandY);
          //} while (the left mouse button is still clicked);
      }
  
      public static void Release(int xPos, int yPos)
      {
          Cursor.Position = new Point(xPos + 25, yPos + 25);
          mouse_event(leftUp, (uint) xPos, (uint) yPos, 0, 0);
      }
  }
  </code></pre>
  
  <p>I've had a hunt of the google and can't find anything for what I need except for a WPF equivalent: <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.mouse.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.input.mouse.aspx</a> </p>
  
  <p>I'm a bit out of my depth, but any help is greatly appreciated.</p>
  
  <p>Lucas.</p>
  
  <ul>
   - 
  </ul>