开发者

Creating/posting input events in C#

Is it possible to programmatically create input events in c#.

I want to be able to simulate any input, such as pressing a button on the keyboard or moving the mouse pointer from my application. The events generated by the application need to behave (preferably) in exactly the same way that an actual key press for instance does (post an event to the system event queue that is given for applications to process).

I seem to be unable to find any documentation about doing this from c# code a开发者_JAVA技巧fter googling for an hour.

As always, any answers will be greatly appreciated.


You can try SendKeys for keyboard input. For more control, and mouse events too, you should P/invoke SendInput().

Be warned that this is difficult to get right and you may find alternative approaches more amenable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜