Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt background service to capture keyboard and mouse activity of user
ZeeshanAsghar last edited by
I want to write a qt windows desktop application that run in background or in system tray and count user keyboard and mouse activity for detecting activeness or idleness.
Can this be possible in QT and how ?
This may be illegal in some countries. Make sure your users will know that such application is running!
I think it could be done, for example by launching a full-screen, transparent QWidget which will intercept all key strokes and then pass them through. I'd expect such solution to be very buggy, though. Maybe there are some Windows-specific APIs for this, I don't know.
Windows has global input hooks that can be used for this.
However, please be aware that all anti-virus software might trigger on your app.
Also if for purely idle detection maybe GetLastInputInfo can be used
fahad64 last edited by
You will need a global input hook API. As QT is thread specific.