|
|
Title | Display an animated mouse cursor |
Keywords | animated, cursor, ani |
Categories | Tips and Tricks, Multimedia, Graphics |
|
|
Thanks to Alexander Willemse
P>
Use the CopyCursor, LoadCursorFromFile, GetCursor, and SetSystemCursor API functions. Use LoadCursorFromFile to load a .ani file containing the animated cursor.
Note: The example program sets the cursor back to normal in its Form_Unload event handler. You should be sure you set it back to normal before your programs end, too.
|
|
Private Sub CmdAnimateCursor_Click()
Dim filename As String
filename = App.Path + "\glas.ani"
new_cursor = LoadCursorFromFile(filename)
old_cursor = GetCursor()
old_cursor = CopyCursor(old_cursor)
SetSystemCursor new_cursor, OCR_NORMAL
CmdAnimateCursor.Enabled = False
CmdNormalCursor.Enabled = True
End Sub
Private Sub CmdNormalCursor_Click()
SetSystemCursor old_cursor, OCR_NORMAL
CmdAnimateCursor.Enabled = True
CmdNormalCursor.Enabled = False
old_cursor = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
If old_cursor <> 0 Then SetSystemCursor old_cursor, _
OCR_NORMAL
End Sub
|
|
Formatted by
Neil Crosby
|
|
|
|
|
|