The ShowCursor API function provides a quick way to hide the
mouse cursor. It takes the following declaration statement
Private Declare Function ShowCursor Lib "user32" _
(ByVal bShow As Long) As Long
When you enter 0 for the bShow argument, the mouse cursor disappears.
Enter -1 to make the mouse reappear. Just be aware when you use
this function, however, that just because you hide the mouse pointer,
doesn't mean it's disabled. To see what we mean, add the above
declaration and the following code to a form.
Dim blnShow As Boolean
Private Sub Form_Click()
blnShow = Not blnShow
ShowCursor blnShow
End Sub
Private Sub Form_Load()
blnShow = True
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
ShowCursor True
End Sub
Now, run the project. When you click the form, Visual Basic toggles
off the cursor's visibility. Click the form once more, and the
mouse cursor reappears. If the mouse cursor had been truly
disabled, you wouldn't have been able to make the mouse cursor
reappear because the click wouldn't have registered. Now, click
the form so the mouse cursor disappears, and move the mouse towards
the IDE's menu bar. As the invisible mouse cursor passes over
each enabled button, it raises, ready to be clicked. In fact,
you can still use the mouse to choose options from the menu bar,
or click on screen objects.