LoadCursorFromFileA function (winuser.h)

Creates a cursor based on data contained in a file.

Note

This function has been superseded by the LoadImage function (with LR_DEFAULTSIZE and LR_LOADFROMFILE flags set).

Syntax

HCURSOR LoadCursorFromFileA(
  [in] LPCSTR lpFileName
);

Parameters

[in] lpFileName

Type: LPCTSTR

The source of the file data to be used to create the cursor. The data in the file must be in either .CUR or .ANI format.

If the high-order word of lpFileName is nonzero, it is a pointer to a string that is a fully qualified name of a file containing cursor data.

Return value

Type: HCURSOR

If the function is successful, the return value is a handle to the new cursor.

If the function fails, the return value is NULL. To get extended error information, call GetLastError. GetLastError may return the following value.

Return code Description
ERROR_FILE_NOT_FOUND
The specified file cannot be found.

Remarks

DPI Virtualization

This API does not participate in DPI virtualization. The output returned is not affected by the DPI of the calling thread.

Note

The winuser.h header defines LoadCursorFromFile as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

Cursors

LoadCursor

Reference

SetCursor

SetSystemCursor