We help IT Professionals succeed at work.

Globally Hide Mouse after Inactive without using constantly running Timer Interval

davidcahan
davidcahan asked
on
I need a way to check to see if a user has not moved the mouse for X seconds and then hide it if they haven't.  It has to work even when the app isn't the active window or when it's minimized (hooks?).  I'd also like it to work without having to use a timer that keeps has a never ending interval.  For instance, if I create a timer and give it an interval of 100ms and then it just constantly checks every 100ms even after the mouse is idle.  I want it to only start checking again once the mouse has gone from idle to active again.

I know this is asking a lot but for about 99% of the time there will be no mouse movement and I think it's a waste of resources to have a timer/tick event constantly running.
Comment
Watch Question

Commented:
Here is what you're looking for: http://www.codeproject.com/KB/cs/globalhook.aspx
unfortunately, even with a hook you still need to globally hide the mouse, even when it is not on top of the active window.  the globally hook can read what the mouse is doing anywhere on the screen but it's a different ball of wax to hide it anywhere on the screen.

Cursor.Hide() only works in the active window.

SetSystemCursor() would likely need to be used.