[DllImport("user32.dll")]
static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function LoadCursor( _
ByVal hInstance As IntPtr, _
ByVal lpCursorName As String) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function LoadCursor( _
ByVal hInstance As IntPtr, _
ByVal lpCursorName As Integer) As IntPtr
End Function
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.
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.
IntPtr handle = LoadCursor(IntPtr.Zero, IDC_Arrow);
Do you know one? Please contribute it!