开发者

Send key to active window

Hey. I don't know if this is possible, but worth a shot. Say there's a third party racing game which doesn't use the mo开发者_如何学Pythonuse. Is there a way for me to create a Windows Form app which listens for mouse clicks and transfers a corresponding key to the game/active window (e.g. Left click would send the 'Up arrow' key to accelerate the Right click would decelerate by sending the 'Down arrow' key). I've looked at the SendKeys method, but it doesn't work once the game becomes the active window. Any ideas? Thanks


if the game uses DirectInput for reading the keys, then SendKeys wont work, as DI works at driver level, and SendKeys/SendInput works at API level, which may be too 'high' for the game to see. you can Hook into DirectInput, and send it commands, but its not going to be a one liner, and if you're new to DirectX, you're not going to find it fun.


I don't know if it would work, and if it is possible, but intuitively, I would check if there is some kind of AutoIt Library for C#.

As far as I know, AutoIt has no problems with sending key press events to games. A couple of methods to integrate AutoIt to C# exist on the internet, but so far, I haven't tried one of them yet.

Still you could give it a shot http://www.lancelarsen.com/Blog/tabid/72/EntryId/48/AutoIt-C-Helper-Library.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜