tracing mouse movements
Hello,
I am writing a client application that should monitor mouse movements on the computer and, in case a mouse is not moved for 5 mins, report to the server that the client is probably away (like ICQ does, but it just changes its icon to Away mode).
I think it might be done by setting a global hook for mouse movements but global hooks are strongly recommended to be avoided. I know it's not a good practice to set up a global, system hook (at least MSDN says so).
Is there another way to do that?
Thanks a lot
# 1 Re: tracing mouse movements
I am writing a client application that should monitor mouse movements on the computer and, in case a mouse is not moved for 5 mins, report to the server that the client is probably away (like ICQ does, but it just changes its icon to Away mode). A hook would be overkill in your case - to simply monitor mouse activity, you can periodically call GetCursorPos() and see if the value changes (checking every few seconds or so is certainly sufficient).
# 3 Re: tracing mouse movements
A hook would be overkill in your case - to simply monitor mouse activity, you can periodically call GetCursorPos() and see if the value changes (checking every few seconds or so is certainly sufficient).
Hi gstercken!
Thats a good solution but if someone wants to monitor keyboard activity too?? Is there anything like getting last key??
Regards,
Usman.
# 4 Re: tracing mouse movements
Hi gstercken!
Thats a good solution but if someone wants to monitor keyboard activity too?? Is there anything like getting last key??No. In this case, you would have to resort to system-wide hooks.