Declare Function LoadCursorFromFile Lib "user32.dll" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Platforms: Win 32s, Win 95/98, Win NT
LoadCursorFromFile loads a cursor from a cursor file. The cursor file can contain either a regular cursor (*.cur) or an animated cursor (*.ani). If successful, the function returns a cursor handle to the newly loaded cursor. If unsuccessful, the function returns 0.
Example:
' Load the cursor "C:\MyProg\custom.ani" and set it as
' the current cursor for three seconds. Then restore the original cursor as
' the current cursor.
Dim hcursor As Long ' receives handle to the loaded cursor
Dim holdcursor As Long ' receives handle to the previously in use cursor
Dim retval As Long ' throw-away return value
hcursor = LoadCursorFromFile("C:\MyProg\custom.ani") ' load the animated cursor from the file
If hcursor = 0 Then End ' abort program if cursor couldn't be loaded
holdcursor = SetCursor(hcursor) ' set the loaded cursor as the current cursor
Sleep 3000 ' wait for three seconds
retval = SetCursor(holdcursor) ' restore the previous cursor
Related Call: LoadCursor
Category: Cursor
Back to the index.