LoadCursor (user32)
Last changed: 185.15.81.195

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);

VB Signature:

<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function LoadCursor( _
    ByVal hInstance As IntPtr, _
    ByVal lpCursorName As String) As IntPtr
End Function

Common VB Overloads:

<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function LoadCursor( _
    ByVal hInstance As IntPtr, _
    ByVal lpCursorName As Integer) As IntPtr
End Function

User-Defined Types:

IDC_

Notes:

This function may not solve your problems when trying to load animated or colored cursors stored as embedded resources. I've wasted hours trying to get it to work to no avail. The LoadCursorFromFile method however works perfectly, so you might want to extract your cursor resource to a temp file and use the P/Invoke for that function.

Tips & Tricks:

If you specify the hInstance as IntPtr.Zero, then you can specify one of the constants in IDC_ as the CursorName to utilize system defined cursors.

Sample Code:

    IntPtr handle = LoadCursor(IntPtr.Zero, IDC_Arrow);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
LoadCursor on MSDN