Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to Simulate A KeyBoard typing on Operation System...
dcbasso last edited by
I'm thinking to make a app to simulate a keyboard typing...
It's not really complicated, I just want to send a keyboard type to Operational System... Something like, type UP, DOWN, LEFT, RIGHT, Volume +, Volume -, ESC... some commands...
I would like to control my PC from another PC... just using the keyboard and nothing else... How can I do that? Any kind of Qt Api, or any lib to make that?
8majkel8 last edited by
It's system related question. On windows you can use BroadcastSystemMessage ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms644932(v=vs.85).aspx ). Look in Windows API reference for more information.
For Windows there's also a little easier function "SendInput":http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310.aspx
The benefit of it is that it simulates the actual input instead of sending the resulting messages to applications. It's easier cause there's no need to handle all possible messages involved in keyboard interaction(there can be a lot in certain scenarios), which are taken care of by the OS.
As for the rest of the app it's a classic server/client situation. One PC is running a server and listens for commands from a client (in this case key strokes) and then executes them. There are "Fortune client/server Qt examples":http://qt-project.org/doc/qt-5.0/qtnetwork/examples-network.html showing how to do that.