Set glodal mouse cursor
Most of control in VB has a MousePointer .we can set me pointer of mouse,such as setbusy cursor.
But sometime we need set a global mouse cursor instead of someone control 's cursor .
At this time .we can use ShowCursor API to do this :
Option Explicit
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Public Enum CursorType
Normal
Busy
HideIt
ShowIt
End Enum
Public Function SetMouseCursor(Status As CursorType) As Boolean
Select Case Status
Case CursorType.Normal
Screen.MousePointer = vbDefault
SetMouseCursor = True
Case CursorType.Busy
Screen.MousePointer = vbHourglass
SetMouseCursor = True
Case CursorType.HideIt
ShowCursor False
SetMouseCursor = True
Case CursorType.ShowIt
ShowCursor True
SetMouseCursor = True
Case Else
SetMouseCursor = False
End Select
End Function
Private Sub Command1_Click()
SetMouseCursor Busy
End Sub
Private Sub Command2_Click()
SetMouseCursor Normal
End Sub