Question

I'm currently studying socket programming, i'm working on creating an application to use my phone as a wireless keyboard/mouse. My current approach is to have the phone app send messages over wi-fi to an application on the computer which will translate those message to keystrokes, mouse movement, and mouse clicks.

The communication part is not the problem, the problem is once the message gets to the application on the computer, i'm not sure how to turned em into keyboard input/mouse input. I did some research and i found a few examples, but most of them required me to select an application to send the input to. Is there a way to just send the input to whatever the current application is? Also most of the examples i saw where for windows only, and i want my application to work in linux, macOS, and windows.

Do you guys have any suggestion on what i could use? or can you point me in the right direction to better research this.

I'm currently using C++ for the application

Was it helpful?

Solution

For Linux, I suggest you inject events into the kernel event subsystem. Look here: http://thiemonge.org/getting-started-with-uinput, specifically in the section "Injecting events in the input subsystem".

OTHER TIPS

Doing something like this requires communicating with the OS. Each OS has a different API.

In many cases you can use a runtime library / framework that will give you a common interface for this. This framework gives you a common interface, but the core of that interface is actually reimplemented for each OS.

However, I am not sure any framework would provide you with this functionality. It's quite likely you will have to reimplement this functionality for each target OS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top