I need to send global keystrokes and mouse events to another application, which is coincidentally using using DirectX. (No controls/handles other than the window itself)
For example, I need to hold key X for 2 seconds and then release it…
I need to push Right Click down on coordinates x:600 and y:350, move the mouse 100 pixels down and then release the Right Click.
I also need to push 2 or more keys at once, like X and Y, and stop X after 2 seconds and Y after 2 more seconds.
So basically I would need full control of the input system…
It would also be ideal if I could control the application while maximized or in background. (optionally)
For the skeptics… The teacher made a DirectX application for drawing for our school. I am asked to make an application that draws samples on it, like a train or flower or something… I will be reading images and use the input to set the color and click on the canvas…
There are some possibilities. You may have a look at
System.Windows.Forms.SendKeysand you can pInvoke some Win32 functions likeSetForegroundWindow(),LockSetForegroundWindow()from gdi32.dll or from user32.dllSetCursorPos()andmouse_eventto perform clicks:Here a snippet for the Mouse events I used a while ago.
Hope that pushes you in the right direction. A good resource is http://pinvoke.net/