0

I am trying to make a remote keyboard application using WinSock2.

I'm currently using sendInput to register a keydown event when a character comes in through the socket. This works great when writing a text documents, but not when playing video games as a keyup event is often required to end a certain action.

The problem is that I'm not sure in what format I should send the keyup event so that I can differentiate it from a keydown event in my code.

I have tried appending a string to char array that gets sent through the socket so I can identify a keyup, but this is very slow and only works ocassionaly for some reason.

Any suggestions on how I should do this would be appreciated.

diederik
  • 141
  • 1
  • 3
  • 8
  • Since you are writing both the client and the server side, the format of the wire protocol is entirely, and completely, up to you. – Sam Varshavchik Jul 05 '16 at 21:08

1 Answers1

0

This issue was resolved. The reason it was inaccurate was because it was sending too many key events.

I fixed it with a simple 100ms sleep.

diederik
  • 141
  • 1
  • 3
  • 8