0

There are many questions relating to simulating mouse/keyboard input in WPF (and Windows, for that matter). I have something a little different than the usual question, I think, and I'd like your input. Most posts I've seen have a specific higher level action in mind: I want to click this, I want to move the mouse here, etc. To emulate these, one can simply use routed events. However, I'm hoping to operate a mouse from a remote app and would like to input mouse events at a low-level: current mouse position is x,y and button state is such and such. My target framework is WPF, but if something like a generic virtual mouse driver is the way to go, I'm cool with that too. I do not have security concerns: the apps receiving the messages will be coded by me at a higher level, so I don't need crazy hacks. I'm willing to use managed or unmanaged code and take the rabbit hole as deep as it needs to go to make this work, but I don't want to reinvent the wheel. I can host my apps in an HwndHost or some such too, in case I need access to windows messages.

Thoughts?

J Trana
  • 2,150
  • 2
  • 20
  • 32

1 Answers1

0

WPF has some built-in automation capabilities. It's a bit complicated, and I've never actually tried it myself, but I've been reading about it recently - it might be worth checking out:

http://msdn.microsoft.com/en-us/library/ms747327.aspx

Or search google for "WPF automation"

Andy White
  • 86,444
  • 48
  • 176
  • 211
  • I don't think this is going to answer my specific query - UI automation seems to be focused at higher level constructs and visual tree action abstractions. I'm looking for raw input abstractions. In a similar post [here](http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/fc8d18b7-fb33-476a-8a1f-5ed41c8e8750/) somebody rejected UI automation for much the same reason. Thanks though. – J Trana Mar 17 '11 at 06:31
  • @J Trana - If you own the apps you want to control, UI Automation is still a good idea IMHO, as you can add specific behavior to your app (overriding the OnCreateAutomationPeer method) so it will be easily controlled remotely. See this article here: http://blogs.msdn.com/b/winuiautomation/archive/2010/05/11/custom-ui-automation-providers-in-depth-part-1.aspx – Simon Mourier Mar 17 '11 at 07:37