making the mouse perform a Drag-Drop with api
-
Im trying to get the mouse to perform a drag and drop using only the api. I can get the mouse to move around and perform clicks for me but the challenge is the drag and drop operation. im trying to store the previous state of the mouse (*ie when it was pressed down*) and then while the previous state==mousedown start dragging and holding it down, until i get a left mouse up message. but i cant get it to work correctly. here is the code im using Input[] input = new Input[ 1 ]; input[0].type = INPUT.MOUSE; input[0].mi.dx = x2; input[0].mi.dy = y2; //input[0].mi.dwFlags = MOUSEEVENTF.MOVE| MOUSEEVENTF.ABSOLUTE ; if(prev.wParam==UserActivityHook.WM_LBUTTONDOWN) { input[0].mi.dwFlags =MOUSEEVENTF.LEFTDOWN| MOUSEEVENTF.ABSOLUTE; SendInput( ( UInt32 ) input.Length, input, Marshal.SizeOf( input[ 0 ]) ); Console.WriteLine("test"); } input[0].mi.dwFlags = MOUSEEVENTF.MOVE| MOUSEEVENTF.ABSOLUTE ; SendInput( ( UInt32 ) input.Length, input, Marshal.SizeOf( input[ 0 ] ) ); Any ideas? i have been looking around online and will continue to. Thanks alot for your help