Unsolved Qt background service to capture keyboard and mouse activity of user
-
Hi
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 ?
Thanks
Zeeshan -
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.
-
hi
Windows has global input hooks that can be used for this.
https://www.geeksforgeeks.org/design-a-keylogger-in-python/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
-
You will need a global input hook API. As QT is thread specific.
https://github.com/kwhat/uiohook
https://github.com/Skycoder42/QHotkey