2

So I'm currently using SendInput as a way of doing keyboard emulation. My problem is that to switch on the emulation the user has to hold down the CTRL button (client's specification :-( ).

I used GetAsyncKeyState(VK_CONTROL) to get the state of the CTRL key, so I can work out the switch part. My problem now is that since the physical CTRL button is pressed, it is not ignored when the SendInput function is used. So instead of emulating say the c button it emulates CTRL + c.

I'd like to know if there is a way for SendInput to ignore physical keyboard presses.

IBG
  • 465
  • 12
  • 34
  • This sounds like [a similar problem to this question](http://stackoverflow.com/q/2914989/2065121) - any use? – Roger Rowland Feb 14 '14 at 05:38
  • Quite similar. I'm currently checking it. Probably slipped my radar because of wording (confused with "depressed"). Thanks. – IBG Feb 14 '14 at 05:56
  • 1
    "depressed" sounds appropriate ;-) – Roger Rowland Feb 14 '14 at 06:12
  • Is that a problem if you just start your Input sequences by CTRL key *down*? – manuell Feb 14 '14 at 11:00
  • Tried it, still a problem. The problem is that the physical CTRL key is being recognized, but I want it ignored. If I included CTRL key down, it'll just add to the problem, and like I said I already tried CTRL key up, but no change. The client's specification is that they need to be pressing down the CTRL key physically so other than persuading them to switch to another key (Fn keys, or at least something that won't call other functions, such as SHIFT), I must deal with it. – IBG Feb 14 '14 at 14:47
  • Sorry, meant CTRL key *up*. Do you mean the user is *still* pressing the CTRL key down while your code use SendInput? (use @manuell when replying to my comments to your question) – manuell Feb 14 '14 at 15:02
  • @manuell yes, user should still be pressing CTRL key down. – IBG Feb 15 '14 at 01:21
  • Sorry I don't know how that would work. You now must explain what is the use case, that is: why such request from the client and why you'd want to use SendInput in the first place. – manuell Feb 15 '14 at 12:50
  • @manuell hmm how do I explain it. We are working on a hand gesture recognition application, and the client wanted to have some sort of keyboard emulation to go with each gesture. That's why I'm using SendInput. As for the CTRL continually being held down,the meetings with the client is held using nihongo, so I don't know how the request came about since I don't speak the language yet. The use case is, instead of just a switch (press CTRL to turn on/off emulation), they want it held down while doing gestures. If it is not held down, no SendInput. If it is held down, use SendInput. – IBG Feb 16 '14 at 02:08

0 Answers0