Shannon Shang-I think therefore I am

We came here, you and I, to this place and this profession, to be great, to do great things, and give form to great dreams - and we have

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

Comments

ch21st said:

# September 24, 2004 2:28 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)