PDA

View Full Version : Mouse detection



eu.x
25th April 2007, 21:00
Hi,

How can I detect if my mouse is moving? My applications has only a System Tray icon.

The thing is I want to know if the user is really using the PC, so I can calculate how much time this user actually worked on this machine. So I need to detect mouse or keyboard events (any event) to make sure the PC is really in use.

wysota
25th April 2007, 21:21
I don't think Qt can help you with that much. I think all you can do is to query the mouse for position using QCursor::pos() every second or so and based on that decide if the mouse is active or not. Just be aware that you'll increase the system load this way.

eu.x
25th April 2007, 21:31
Cool!

How about keyboard detection?

wysota
25th April 2007, 23:06
With plain Qt you can forget about that. You'd have to dive into platform dependent solutions.