How to Show/Hide/Restore Mouse Cursor
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 'System & API - How to Show/Hide/Restore Mouse Cursor Option Explicit ' Mouse/cursor functions. Private lShowCursor As Long Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long ' Hides the mouse cursor. Public Sub HideMouse() Dim iResult As Integer Do lShowCursor = lShowCursor - 1 iResult = ShowCursor(False) Loop Until iResult < 0 End Sub ' Restores the mouse cursor to it's previous state regardless if HideMouse and ShowMouse were called. Public Sub RestoreMouse() If lShowCursor > 0 Then Do While lShowCursor <> 0 ShowCursor (False) lShowCursor = lShowCursor - 1 Loop ElseIf lShowCursor < 0 Then Do While lShowCursor <> 0 ShowCursor (True) lShowCursor = lShowCursor + 1 Loop End If End Sub ' Show's the mouse cursor. Public Sub ShowMouse() Dim iResult As Integer Do lShowCursor = lShowCursor - 1 iResult = ShowCursor(True) Loop Until iResult >= 0 End Sub |
Related posts:
- How to Set Mouse Cursor position
- How to create a screen saver.
- How to show/hide the cursor/caret in a text box
- How to show Accessability Properties (Mouse)
- How to show Mouse Properties Control Panel
- How to Move the Cursor to the Control that has focus
- How to Show/Hide all Desktop Icons
- How to Limit Cursor Movement to Form Boundaries
- How to Show/Hide your SystemTray
- How to Show/Hide the Start Button from the task bar








