How to simulate keyboard input in ALL applications?

后端 未结 3 1918
天涯浪人
天涯浪人 2021-02-08 21:50

I\'m writing an app (in C#) which as a part of it must simulate and send some key strokes to another application. I\'m using http://inputsimulator.codeplex.com/ project for simu

相关标签:
3条回答
  • 2021-02-08 21:52

    Take a look at SendKeys on MSDN

    0 讨论(0)
  • 2021-02-08 21:59

    Ok, I think I finally got it to work. I used API Monitor recommended by Neal P and it showed just minimal differences between OSK calls and mine. A bit later I've tried to make my calling thread sleep some time between sending messages with press and release key and that was it.

    0 讨论(0)
  • 2021-02-08 22:00

    Although you were able to achieve your purpose, the way you achieved it does not fundamentally answer your question: How to simulate keyboard input in ALL applications?

    There's a bunch of situations where the common user mode Microsoft API already mentioned does not work, like game applications that use the DirectInput API or protected games.

    I have built a library that can help in this situations, it provides a simple C API that internally communicates with device filter drivers. It is able to send input for DirectInput based games and also is able to bypass some game protections. I have checked and it is still able to bypass some known game protections by using the x64 version of the library. Game protections commonly hook only the x86 system's api. Well, at last now, 18 February 2012, this is what I'm seeing happening.

    0 讨论(0)
提交回复
热议问题