From f9f07c8ba6e1677b83e9136d7466794838ba8792 Mon Sep 17 00:00:00 2001 From: dahall Date: Wed, 29 Jul 2020 17:29:32 -0600 Subject: [PATCH] Added class StandardCursor with values IDC_xx for LoadCursor --- PInvoke/User32/WinUser.Cursor.cs | 63 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/PInvoke/User32/WinUser.Cursor.cs b/PInvoke/User32/WinUser.Cursor.cs index 0f536d01..aee12672 100644 --- a/PInvoke/User32/WinUser.Cursor.cs +++ b/PInvoke/User32/WinUser.Cursor.cs @@ -612,7 +612,7 @@ namespace Vanara.PInvoke // LPCSTR lpCursorName ); [DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winuser.h", MSDNShortId = "loadcursor")] - public static extern SafeHCURSOR LoadCursor(HINSTANCE hInstance, ResourceId lpCursorName); + public static extern SafeHCURSOR LoadCursor([Optional] HINSTANCE hInstance, ResourceId lpCursorName); /// /// Creates a cursor based on data contained in a file. @@ -951,5 +951,66 @@ namespace Vanara.PInvoke /// protected override bool InternalReleaseHandle() => DestroyCursor(this); } + + /// Predefined cursors for . + [PInvokeData("winuser.h", MSDNShortId = "loadcursor")] + public static class StandardCursor + { + /// Standard arrow + public static readonly ResourceId IDC_ARROW = 32512; + + /// I-beam + public static readonly ResourceId IDC_IBEAM = 32513; + + /// Hourglass + public static readonly ResourceId IDC_WAIT = 32514; + + /// Crosshair + public static readonly ResourceId IDC_CROSS = 32515; + + /// Vertical arrow + public static readonly ResourceId IDC_UPARROW = 32516; + + /// Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL. + [Obsolete("Use IDC_SIZEALL")] + public static readonly ResourceId IDC_SIZE = 32640; /* OBSOLETE: use IDC_SIZEALL */ + + /// Obsolete for applications marked version 4.0 or later. + [Obsolete("Use IDC_ARROW")] + public static readonly ResourceId IDC_ICON = 32641; /* OBSOLETE: use IDC_ARROW */ + + /// Double-pointed arrow pointing northwest and southeast + public static readonly ResourceId IDC_SIZENWSE = 32642; + + /// Double-pointed arrow pointing northeast and southwest + public static readonly ResourceId IDC_SIZENESW = 32643; + + /// Double-pointed arrow pointing west and east + public static readonly ResourceId IDC_SIZEWE = 32644; + + /// Double-pointed arrow pointing north and south + public static readonly ResourceId IDC_SIZENS = 32645; + + /// Four-pointed arrow pointing north, south, east, and west + public static readonly ResourceId IDC_SIZEALL = 32646; + + /// Slashed circle + public static readonly ResourceId IDC_NO = 32648; /*not in win3.1 */ + + /// Hand + public static readonly ResourceId IDC_HAND = 32649; + + /// Standard arrow and small hourglass + public static readonly ResourceId IDC_APPSTARTING = 32650; /*not in win3.1 */ + + /// Arrow and question mark + public static readonly ResourceId IDC_HELP = 32651; + + /// Undocumented + public static readonly ResourceId IDC_PIN = 32671; + + /// Undocumented + public static readonly ResourceId IDC_PERSON = 32672; + } } } \ No newline at end of file