'2 API:
'ADD A BLANK FORM AND PASTE THE FOLLOWING CODES TO IT ,THEN LEFT MOUSE DOWN OR RIGHT MOUSE DOWN
Option Explicit
Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
Private Const OCR_NORMAL = 32512
Dim newcursor As Long
Dim cursors As New Collection
Sub loadcursors() ' load cursors from system
Dim mydir As String, fname As String
mydir = Environ("windir") & "\cursors\"
fname = Dir(mydir)
Do While fname <> ""
cursors.Add mydir & fname
fname = Dir
Loop
End Sub
Sub loaddefaultcursor()
Dim defaultcursor As Long ' set default system cursor
defaultcursor = LoadCursorFromFile(Environ("windir") & "\cursors\arrow_l.cur")
SetSystemCursor defaultcursor, OCR_NORMAL
End Sub
Sub loadnewcursor() ' set a new system cursor
Dim cursorfile As String
Randomize
cursorfile = cursors(Int(Rnd * cursors.Count + 1)) 'random cursor file
newcursor = LoadCursorFromFile(cursorfile)
SetSystemCursor newcursor, OCR_NORMAL
Me.Caption = cursorfile
End Sub
Private Sub Form_Load()
loadcursors
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then loadnewcursor
If Button = 2 Then loaddefaultcursor
End Sub
Private Sub Form_Unload(Cancel As Integer) ' default system cursor
loaddefaultcursor
End Sub