LoadCursorFromFile Function

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.

lpFileName
The filename of the cursor file to load. This file can either be a *.cur or an *.ani cursor file.

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

See Also: LoadCursor
Category: Cursor

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/l/loadcursorfromfile.html