Attribute VB_Name = "modCursor"
Option Explicit

Const IDC_WAIT = 32514

Public Declare Function LoadCursor Lib "coredll" _
    Alias "LoadCursorW" ( _
    ByVal hInstance As Long, _
    ByVal lpCursorName As Long) As Long

Public Declare Function SetCursor Lib "coredll" (ByVal hCursor As Long) As Long

Function WaitCursor(bWait As Boolean) As Long
    Dim hCursor As Long
    If bWait Then                           'Obtain the handle to the cursor
        hCursor = LoadCursor(0, IDC_WAIT)   'Get handle to the wait cursor
    Else
        hCursor = LoadCursor(0, 0)          'Restore default cursor
    End If
    WaitCursor = SetCursor(hCursor)         'Set the cursor based on the cursor handle
End Function

