LoadCursorFromFile function
Applies to: desktop apps only
Creates a cursor based on data contained in a file.
Syntax
HCURSOR WINAPI LoadCursorFromFile( __in LPCTSTR lpFileName );
Parameters
- lpFileName [in]
-
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 |
|---|---|
|
The specified file cannot be found. |
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | LoadCursorFromFileW (Unicode) and LoadCursorFromFileA (ANSI) |
See also
- Reference
- LoadCursor
- SetCursor
- SetSystemCursor
- Conceptual
- Cursors
Send comments about this topic to Microsoft
Build date: 2/3/2012
See DestroyCursor(): http://msdn.microsoft.com/en-us/library/ms648386%28v=vs.85%29.aspx
To load a non-shared cursor from a file, use LoadImage() with IMAGE_CURSOR and LR_LOADFROMFILE, and without LR_SHARED.
See LoadImage(): http://msdn.microsoft.com/en-us/library/ms648045%28v=vs.85%29.aspx
- 1/25/2012
- Uray M. János
- 1/25/2012
- Uray M. János
static extern Intptr LoadCursorFromFile(String lpFileName)
Example:
Intptr cursorHandle =LoadCursorFromFile("D:\\animatedCursor.cur");
//create new cursor from handle
Cursor newCursor=new Cursor(cursorHandle);
//Set cursor
this.cursor=newCursor;
- 12/2/2009
- Mahesh Bagul