Question:
During run-time, for a particular reason, how do i hide/unhide mouse pointer?
Answer:
Here’s how to hide the Mousepointer:The Declaration:
Declare Function ShowCursor Lib “User” (ByVal bShow As Integer) As IntegerThe Call:
x = ShowCursor(True)or:
x = ShowCursor(False)Be careful, though! This can backfire on the VB programmer just as it canbackfire on any other Windows Programmer. Because the cursor is a shared resource,there is an internal *cumulative* cursor display-count so that different processes can electto show or hide the cursor. Below is a paraphrasing (mine) of what the Win SDK hasto say on the ShowCursor fuction:
“The true or false argument specifies whether the display count is incremented or decremented. If TRUE, the display count is incremented; otherwise, it is decremented. The return valueis the new display count, if the function is successful. The cursor is visible only if the count is greater than or equal to zero. If a mouse exists, the initial setting of the cursor show level is zero; otherwise, it is -1. A window that hides the cursor should show it before the cursor leaves its client area or before the window relinquishes control to another window.”In a nutshell, if you elect to hide the cursor, show it again before your process ends! The thing mostfolks use this for is making screensavers (which is really just a renamed executable with a coupleteeny bells and whistles for command-line parsing and that sets a true/false state to Windows to”tell it” a screensaver is running), or games/graphics where the mousepointer gets in the way.