3

I created a keypad app that stays on top, but does not take the focus so that on a touch screen it will forward whatever keys you press to the active application via SendKeys.

It works perfectly with every application I have tried it with... except, of course, for the one I actually need it to work with which is a Point Of Sale application. The POS application lets the user type in item codes on the keyboard but it doesn't have a good keypad for touchscreens so that's why I'm trying to create an external one for it (since I don't have access to the POS application code).

It actually does work when you first try it, but then it's pretty sporadic. Using the keyboard directly always works, so I'm not sure why SendKeys only works sometimes with this application. I've tried implementing it several ways... sending the keys as they are pressed, sending them altogether when the user presses the enter button on the keypad, copying the keys to the clipboard and then using send keys to do a Ctl-V and then Enter.

What other options do I have to simulate a key press to another application? SendKeys doesn't seem to perfectly simulate key presses, so is there a lower level mechanism I can tap into?

I should mention that when it doesn't work, what happens is that I get a beep from the POS application as though I'd pressed an invalid key. So it's not that it isn't getting some kind of input but clearly it isn't getting the key I'm sending it the same way it would from an actual keyboard.

BVernon
  • 3,205
  • 5
  • 28
  • 64
  • 1
    possible duplicate of [Alternative to SendKeys when running over Remote Desktop?](http://stackoverflow.com/questions/1138606/alternative-to-sendkeys-when-running-over-remote-desktop) – Greg the Incredulous Feb 23 '15 at 00:10
  • @GregtheIncredulous That question is about running send keys over Remote Desktop (as noted in the question) and from what I can tell, even the closest answer that might apply here requires making changes to the source code of the target application... which, if I had access to it, I wouldn't be doing this. – BVernon Mar 09 '15 at 14:59
  • Could I possibly know more about your first application? I've been trying to create an application that uses button presses or hotkeys to generate certain special characters, and have been really struggling to use SendKeys or any of the other methods. It doesn't need to be perfect, just good enough. – Lou Dec 18 '16 at 23:32
  • @LeoKing Have you looked into the answer I posted below? What is it you need that that program can't do? – BVernon Dec 19 '16 at 17:40
  • I didn't see that. Though, when I click the link, it just takes me to a page full of HTML. It doesn't go to a website. – Lou Dec 20 '16 at 23:31
  • @LeoKing Just look for InputSimulator on NuGet – BVernon Dec 22 '16 at 17:47

1 Answers1

4

I found this Windows Input Simulator: https://inputsimulator.codeplex.com/

Super easy to use and way, way, way better than SendKeys. And as a bonus, in addition to letting you simulate input, it also lets you set low level keyboard/mouse hooks.

BVernon
  • 3,205
  • 5
  • 28
  • 64