Option Explicit
Private Declare Function CopyCursor Lib "user32" Alias "CopyIcon" (ByVal hcur As Long) As Long
Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function GetCursor Lib "user32" () As Long
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
Private Const OCR_NORMAL = 32512
Dim new_cursor As Long
Dim old_cursor As Long
Private Sub CmdAnimateCursor_Click()
Dim filename As String
' I Windows finns 3st animerade cursors som standard
' globe.ani, hourglas.ani och appstart.ani
filename = "C:\Windows\Cursors\hourglas.ani"
' Spara gamla cursorn och ladda in nya cursorn
new_cursor = LoadCursorFromFile(filename)
old_cursor = GetCursor()
old_cursor = CopyCursor(old_cursor)
SetSystemCursor new_cursor, OCR_NORMAL
End Sub
Private Sub CmdNormalCursor_Click()
' återställer cursorn
SetSystemCursor old_cursor, OCR_NORMAL
End Sub