C++/How can I hide the system cursor
In Windows XP, I would like to hide the system cursor instead of just hiding the cursor within my application (not too hard to do) once the mouse is idle for a certain period of time. So if my app is running (and say the size of the app is small enough that you can see the desktop still) and if the cursor is hovering on the desktop, I want to not have the cursor be visible.
However, no matter what I've tried, I can't seem to hide the system cursor. I've gotten the window handle for which cursor is sitting under (http://support.microsoft.com/?kbid=230495
) and then change the cursor using SetCursor(NULL) but no avail.
The other thing I've tried is using a hook (SetWindowsHookEx) to trap WM_MOUSEMOVE and then set up a timer to see how long it's been idle. At a specified time, I call SetCursor(NULL) but it also doesn't work. Seems that when you call SetCursor from the timerProc, you're no longer at the global level to change the system cursor.
Do you have any other suggestions that I could try?
Justin, Thank you for your question.
The call SetCursor(NULL) is ignored by the system on some versions of Windows. To set the cursor invisible, construct an actual invisible cursor using the CreateCursor function. See the MSDN Library documentation for details.
I have my doubts about your app. Making the cursor invisible system-wide does not seem to be a good idea unless all of your apps are guaranteed to be image displaying apps (in which case some argument can be made for hiding the cursor). Hiding the cursor means that the mouse must be moved before the user can see where it is.