by Raghu (22 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 31st August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
To Change the System Cursor
API Declarations
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 'Standard Mouse Cursor
Private Const OCR_WAIT = 32514 'Hour Glass
Private Const OCR_NO = 32648 'NO Cursor
Dim hCursor As Long 'To Store the Handle of the Cursor
'To Store the Path of the Cursor File or ANImated Cursor file
Dim CurPath As String
Private Sub Command1_Click()
CurPath = "C:\Program Files\Plus!\Themes\Simpsons\Simpsons Cursor.cur"
hCursor = LoadCursorFromFile(CurPath)
If hCursor > 0 Then
retVal = SetSystemCursor(hCursor, OCR_NORMAL)
End If
If ret > 0 Then MsgBox "System Cursor Changed", vbExclamation, "Cursor"
End Sub