From 94a761c3267050a16d53e8069edfc6c52b236b06 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 8 Jun 2023 18:21:28 -0600 Subject: [PATCH] Lots of changes for rich edit --- PInvoke/Accessibility/Oleacc.cs | 401 +- PInvoke/ComCtl32/CommCtrl.Edit.cs | 34 +- PInvoke/MsftEdit/RichEdit.cs | 3165 +++++++++- PInvoke/MsftEdit/TOM.cs | 6334 ++++++++++++++++++-- PInvoke/MsftEdit/TextServ.cs | 1 + PInvoke/MsftEdit/Vanara.PInvoke.MsftEdit.csproj | 3 +- PInvoke/UIAutomation/UIAutomationClient.cs | 2222 +++++++ PInvoke/UIAutomation/UIAutomationCore.cs | 5878 ++++++++++++++++++ .../Vanara.PInvoke.UIAutomation.csproj | 22 + PInvoke/User32/VisibleWindow.cs | 3 + PInvoke/User32/WinUser.Edit.cs | 2529 ++++++-- PInvoke/User32/WindowBase.cs | 5 + UnitTests/PInovke/MsftEdit/MsftEdit.csproj | 19 + UnitTests/PInovke/MsftEdit/MsftEditTests.cs | 71 + Vanara.sln | 44 +- 15 files changed, 19723 insertions(+), 1008 deletions(-) create mode 100644 PInvoke/UIAutomation/UIAutomationClient.cs create mode 100644 PInvoke/UIAutomation/UIAutomationCore.cs create mode 100644 PInvoke/UIAutomation/Vanara.PInvoke.UIAutomation.csproj create mode 100644 UnitTests/PInovke/MsftEdit/MsftEdit.csproj create mode 100644 UnitTests/PInovke/MsftEdit/MsftEditTests.cs diff --git a/PInvoke/Accessibility/Oleacc.cs b/PInvoke/Accessibility/Oleacc.cs index 259ace87..4bed20d3 100644 --- a/PInvoke/Accessibility/Oleacc.cs +++ b/PInvoke/Accessibility/Oleacc.cs @@ -6,29 +6,9 @@ using System.Text; namespace Vanara.PInvoke; #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + public static partial class Oleacc { - // Input to DISPID_ACC_NAVIGATE - private const int NAVDIR_DOWN = 0x00000002; - private const int NAVDIR_FIRSTCHILD = 0x00000007; - private const int NAVDIR_LASTCHILD = 0x00000008; - private const int NAVDIR_LEFT = 0x00000003; - private const int NAVDIR_MAX = 0x00000009; - private const int NAVDIR_MIN = 0x00000000; - private const int NAVDIR_NEXT = 0x00000005; - private const int NAVDIR_PREVIOUS = 0x00000006; - private const int NAVDIR_RIGHT = 0x00000004; - private const int NAVDIR_UP = 0x00000001; - - // Input to DISPID_ACC_SELECT - private const int SELFLAG_ADDSELECTION = 0x00000008; - private const int SELFLAG_EXTENDSELECTION = 0x00000004; - private const int SELFLAG_NONE = 0x00000000; - private const int SELFLAG_REMOVESELECTION = 0x00000010; - private const int SELFLAG_TAKEFOCUS = 0x00000001; - private const int SELFLAG_TAKESELECTION = 0x00000002; - private const int SELFLAG_VALID = 0x0000001F; - public enum AccessibilityRole : uint { ROLE_SYSTEM_TITLEBAR = 0x00000001, @@ -154,8 +134,8 @@ public static partial class Oleacc ANRUS_PRIORITY_AUDIO_ACTIVE = 0x0000004, /// - /// The AT application is relying on audio (such as text-to-speech) to convey essential information to the user but should not - /// change relative to other system sounds. + /// The AT application is relying on audio (such as text-to-speech) to convey essential information to the user but should not change + /// relative to other system sounds. /// ANRUS_PRIORITY_AUDIO_ACTIVE_NODUCK = 0x0000008, @@ -163,6 +143,140 @@ public static partial class Oleacc ANRUS_PRIORITY_AUDIO_DYNAMIC_DUCK = 0x0000010, } + /// + /// This topic describes the constant values, defined in oleacc.h, that indicate the spatial (up, down, left, and right) or logical + /// (first child, last, next, and previous) direction observed when clients use IAccessible::accNavigate to navigate from one user + /// interface element to another within the same container. For more information, see Object Navigation Properties and Methods. + /// + // https://learn.microsoft.com/en-us/windows/win32/winauto/navigation-constants + [PInvokeData("Oleacc.h")] + public enum NAVDIR + { + /// Navigate to the sibling object that is located below the starting object. + NAVDIR_DOWN = 0x00000002, + + /// + /// Navigate to the first child of this object. When this flag is used, the lVal member of the varStart parameter must + /// be CHILDID_SELF. + /// + NAVDIR_FIRSTCHILD = 0x00000007, + + /// + /// Navigate to the last child of this object. When using this flag, the lVal member of the varStart parameter must be CHILDID_SELF. + /// + NAVDIR_LASTCHILD = 0x00000008, + + /// Navigate to the sibling object located to the left of the starting object. + NAVDIR_LEFT = 0x00000003, + + /// + NAVDIR_MAX = 0x00000009, + + /// + NAVDIR_MIN = 0x00000000, + + /// Navigate to the next logical object; generally, it is a sibling of the starting object. + NAVDIR_NEXT = 0x00000005, + + /// Navigate to the previous logical object; generally, it is a sibling of the starting object. + NAVDIR_PREVIOUS = 0x00000006, + + /// Navigate to the sibling object that is located to the right of the starting object. + NAVDIR_RIGHT = 0x00000004, + + /// Navigate to the sibling object that is located above the starting object. + NAVDIR_UP = 0x00000001, + } + + /// Inputs to IAccessible::accHitTest. The following are the valid values for the varChild parameter. + [PInvokeData("Oleacc.h")] + [Flags] + public enum SELFLAG + { + /// + /// Adds the object to the current selection; possible result is a noncontiguous selection. + /// + /// Unless it is combined with SELFLAG_TAKEFOCUS, this flag does not change the focus or the selection anchor. The + /// SELFLAG_ADDSELECTION / SELFLAG_TAKEFOCUS combination is equivalent to adding an item to a selection manually by holding down the + /// CTRL key and clicking an unselected object in Windows Explorer. + /// + /// This flag is not combined with SELFLAG_REMOVESELECTION or SELFLAG_TAKESELECTION. + /// + SELFLAG_ADDSELECTION = 0x00000008, + + /// + /// + /// Alters the selection so that all objects between the selection anchor and this object take on the anchor object's selection + /// state. If the anchor object is not selected, the objects are removed from the selection. If the anchor object is selected, the + /// selection is extended to include this object and all the objects in between. Set the selection state by combining this flag with + /// SELFLAG_ADDSELECTION or SELFLAG_REMOVESELECTION. + /// + /// + /// Unless it is combined with SELFLAG_TAKEFOCUS, this flag does not change the focus or the selection anchor. The + /// SELFLAG_EXTENDSELECTION / SELFLAG_TAKEFOCUS combination is equivalent to adding an item to a selection manually by holding down + /// the SHIFT key and clicking an unselected object in Windows Explorer. + /// + /// This flag is not combined with SELFLAG_TAKESELECTION. + /// + SELFLAG_EXTENDSELECTION = 0x00000004, + + /// Performs no action. Microsoft Active Accessibility does not change the selection or focus. + SELFLAG_NONE = 0x00000000, + + /// + /// Removes the object from the current selection; possible result is a noncontiguous selection. + /// + /// Unless it is combined with SELFLAG_TAKEFOCUS, this flag does not change the focus or the selection anchor. The + /// SELFLAG_REMOVESELECTION / SELFLAG_TAKEFOCUS combination is equivalent to removing an item from a selection manually, by holding + /// down the CTRL key while clicking a selected object in Windows Explorer. + /// + /// This flag is not combined with SELFLAG_ADDSELECTION or SELFLAG_TAKESELECTION. + /// + SELFLAG_REMOVESELECTION = 0x00000010, + + /// + /// + /// Sets the focus to the object and makes it the selection anchor. Used by itself, this flag does not alter the selection. The + /// effect is similar to moving the focus manually by pressing an ARROW key while holding down the CTRL key in Windows Explorer or in + /// any multiple-selection list box. + /// + /// With objects that have the STATE_SYSTEM_MULTISELECTABLE, SELFLAG_TAKEFOCUS is combined with the following values: + /// + /// SELFLAG_TAKESELECTION + /// SELFLAG_EXTENDSELECTION + /// SELFLAG_ADDSELECTION + /// SELFLAG_REMOVESELECTION + /// SELFLAG_ADDSELECTION + /// SELFLAG_EXTENDSELECTION + /// SELFLAG_REMOVESELECTION + /// SELFLAG_EXTENDSELECTION + /// + /// + /// If you call IAccessible::accSelect with the SELFLAG_TAKEFOCUS flag on an object that has an HWND, the flag will take effect only + /// if the object's parent already has the focus. + /// + /// + SELFLAG_TAKEFOCUS = 0x00000001, + + /// + /// Selects the object and removes the selection from all other objects in the container. + /// + /// Unless it is combined with SELFLAG_TAKEFOCUS, this flag does not change the focus or the selection anchor. The + /// SELFLAG_TAKESELECTION / SELFLAG_TAKEFOCUS combination is equivalent to single-clicking an item in Windows Explorer. + /// + /// This flag must not be combined with the following flags: + /// + /// SELFLAG_ADDSELECTION + /// SELFLAG_REMOVESELECTION + /// SELFLAG_EXTENDSELECTION + /// + /// + SELFLAG_TAKESELECTION = 0x00000002, + + /// The selflag valid + SELFLAG_VALID = 0x0000001F, + } + /// Retrieves the child ID or IDispatch of each child within an accessible container object. /// /// Type: IAccessible* @@ -171,8 +285,8 @@ public static partial class Oleacc /// /// Type: LONG /// - /// Specifies the zero-based index of the first child that is retrieved. This parameter is an index, not a child ID, and it is - /// usually is set to zero (0). + /// Specifies the zero-based index of the first child that is retrieved. This parameter is an index, not a child ID, and it is usually is + /// set to zero (0). /// /// /// @@ -183,16 +297,16 @@ public static partial class Oleacc /// Type: VARIANT* /// /// Pointer to an array of VARIANT structures that receives information about the container's children. If the vt member of an - /// array element is VT_I4, then the lVal member for that element is the child ID. If the vt member of an array element - /// is VT_DISPATCH, then the pdispVal member for that element is the address of the child object's IDispatch interface. + /// array element is VT_I4, then the lVal member for that element is the child ID. If the vt member of an array element is + /// VT_DISPATCH, then the pdispVal member for that element is the address of the child object's IDispatch interface. /// /// /// /// Type: LONG* /// /// Address of a variable that receives the number of elements in the rgvarChildren array that is populated by the - /// AccessibleChildren function. This value is the same as that of the cChildren parameter; however, if you request more - /// children than exist, this value will be less than that of cChildren. + /// AccessibleChildren function. This value is the same as that of the cChildren parameter; however, if you request more children + /// than exist, this value will be less than that of cChildren. /// /// /// @@ -216,22 +330,21 @@ public static partial class Oleacc /// /// /// - /// To retrieve information about all of the children in a container, the iChildStart parameter must be zero (0), and cChildren must - /// be the value returned by IAccessible::get_accChildCount. + /// To retrieve information about all of the children in a container, the iChildStart parameter must be zero (0), and cChildren must be + /// the value returned by IAccessible::get_accChildCount. /// /// /// When calling this function to obtain information about the children of a user interface element, it is recommended that clients - /// obtain information about all of the children. For example, iChildStart must be zero (0), and cChildren must be the value returned - /// by IAccessible::get_accChildCount. + /// obtain information about all of the children. For example, iChildStart must be zero (0), and cChildren must be the value returned by IAccessible::get_accChildCount. /// /// - /// If a child ID is returned for an element, then the container must provide information about the child element. To obtain - /// information about the element, clients use the container's IAccessible interface pointer and specify the obtained child ID in - /// calls to the IAccessible properties. + /// If a child ID is returned for an element, then the container must provide information about the child element. To obtain information + /// about the element, clients use the container's IAccessible interface pointer and specify the obtained child ID in calls to the + /// IAccessible properties. /// /// - /// Clients must call the IUnknown::Release method for any IDispatch interfaces retrieved by this function, and free the array when - /// it is no longer required. + /// Clients must call the IUnknown::Release method for any IDispatch interfaces retrieved by this function, and free the array when it is + /// no longer required. /// /// Examples /// @@ -246,14 +359,14 @@ public static partial class Oleacc public static extern HRESULT AccessibleChildren(IAccessible paccContainer, int iChildStart, int cChildren, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Struct, SizeParamIndex = 2)] object[] rgvarChildren, out int pcObtained); /// - /// Retrieves the address of the IAccessible interface for the object that generated the event that is currently being processed by - /// the client's event hook function. + /// Retrieves the address of the IAccessible interface for the object that generated the event that is currently being processed by the + /// client's event hook function. /// /// /// Type: HWND /// - /// Specifies the window handle of the window that generated the event. This value must be the window handle that is sent to the - /// event hook function. + /// Specifies the window handle of the window that generated the event. This value must be the window handle that is sent to the event + /// hook function. /// /// /// @@ -265,9 +378,9 @@ public static partial class Oleacc /// /// Type: DWORD /// - /// Specifies whether the event was triggered by an object or one of its child elements. If the object triggered the event, dwChildID - /// is CHILDID_SELF. If a child element triggered the event, dwChildID is the element's child ID. This value must be the child ID - /// that is sent to the event hook function. + /// Specifies whether the event was triggered by an object or one of its child elements. If the object triggered the event, dwChildID is + /// CHILDID_SELF. If a child element triggered the event, dwChildID is the element's child ID. This value must be the child ID that is + /// sent to the event hook function. /// /// /// @@ -303,19 +416,19 @@ public static partial class Oleacc /// function must be used for this function's hwnd, dwObjectID, and dwChildID parameters. /// /// - /// This function retrieves the lowest-level accessible object in the object hierarchy that is associated with an event. If the - /// element that generated the event is not an accessible object (that is, does not support IAccessible), then the function retrieves - /// the IAccessible interface of the parent object. The parent object must provide information about the child element through - /// the IAccessible interface. + /// This function retrieves the lowest-level accessible object in the object hierarchy that is associated with an event. If the element + /// that generated the event is not an accessible object (that is, does not support IAccessible), then the function retrieves the + /// IAccessible interface of the parent object. The parent object must provide information about the child element through the + /// IAccessible interface. /// /// - /// As with other IAccessible methods and functions, clients might receive errors for IAccessible interface pointers because - /// of a user action. For more information, see Receiving Errors for IAccessible Interface Pointers. + /// As with other IAccessible methods and functions, clients might receive errors for IAccessible interface pointers because of a + /// user action. For more information, see Receiving Errors for IAccessible Interface Pointers. /// /// /// This function fails if called in response to EVENT_OBJECT_CREATE because the object is not fully initialized. Similarly, clients - /// should not call this in response to EVENT_OBJECT_DESTROY because the object is no longer available and cannot respond. Clients - /// watch for EVENT_OBJECT_SHOW and EVENT_OBJECT_HIDE events rather than for EVENT_OBJECT_CREATE and EVENT_OBJECT_DESTROY. + /// should not call this in response to EVENT_OBJECT_DESTROY because the object is no longer available and cannot respond. Clients watch + /// for EVENT_OBJECT_SHOW and EVENT_OBJECT_HIDE events rather than for EVENT_OBJECT_CREATE and EVENT_OBJECT_DESTROY. /// /// Examples /// The following example code shows this method being called in a WinEventProc event handler. @@ -326,9 +439,7 @@ public static partial class Oleacc [PInvokeData("oleacc.h", MSDNShortId = "d453c163-3918-4a1c-9636-16816227a295")] public static extern HRESULT AccessibleObjectFromEvent(HWND hwnd, uint dwId, uint dwChildId, out IAccessible ppacc, [MarshalAs(UnmanagedType.Struct)] out object pvarChild); - /// - /// Retrieves the address of the IAccessible interface pointer for the object displayed at a specified point on the screen. - /// + /// Retrieves the address of the IAccessible interface pointer for the object displayed at a specified point on the screen. /// Specifies, in physical screen coordinates, the point that is examined. /// Address of a pointer variable that receives the address of the object's IAccessible interface. /// @@ -355,14 +466,14 @@ public static partial class Oleacc /// /// /// - /// This function retrieves the lowest-level accessible object in the object hierarchy at a given point. If the element at the point - /// is not an accessible object (that is, does not support IAccessible), then the function retrieves the IAccessible interface - /// of the parent object. The parent object must provide information about the child element through the IAccessible - /// interface. Call IAccessible::accHitTest to identify the child element at the specified screen coordinates. + /// This function retrieves the lowest-level accessible object in the object hierarchy at a given point. If the element at the point is + /// not an accessible object (that is, does not support IAccessible), then the function retrieves the IAccessible interface of the + /// parent object. The parent object must provide information about the child element through the IAccessible interface. Call + /// IAccessible::accHitTest to identify the child element at the specified screen coordinates. /// /// - /// As with other IAccessible methods and functions, clients might receive errors for IAccessible interface pointers because - /// of a user action. For more information, see Receiving Errors for IAccessible Interface Pointers. + /// As with other IAccessible methods and functions, clients might receive errors for IAccessible interface pointers because of a + /// user action. For more information, see Receiving Errors for IAccessible Interface Pointers. /// /// Client Example /// @@ -386,16 +497,16 @@ public static partial class Oleacc /// /// Type: DWORD /// - /// Specifies the object ID. This value is one of the standard object identifier constants or a custom object ID such as - /// OBJID_NATIVEOM, which is the object ID for the Office native object model. For more information about OBJID_NATIVEOM, see - /// the Remarks section in this topic. + /// Specifies the object ID. This value is one of the standard object identifier constants or a custom object ID such as OBJID_NATIVEOM, + /// which is the object ID for the Office native object model. For more information about OBJID_NATIVEOM, see the Remarks section + /// in this topic. /// /// /// /// Type: REFIID /// - /// Specifies the reference identifier of the requested interface. This value is either IID_IAccessible or IID_IDispatch, but it can - /// also be IID_IUnknown, or the IID of any interface that the object is expected to support. + /// Specifies the reference identifier of the requested interface. This value is either IID_IAccessible or IID_IDispatch, but it can also + /// be IID_IUnknown, or the IID of any interface that the object is expected to support. /// /// /// @@ -423,21 +534,20 @@ public static partial class Oleacc /// /// /// - /// Clients call this function to retrieve the address of an object's IAccessible, IDispatch, IEnumVARIANT, IUnknown, or other - /// supported interface pointer. + /// Clients call this function to retrieve the address of an object's IAccessible, IDispatch, IEnumVARIANT, IUnknown, or other supported + /// interface pointer. /// /// - /// As with other IAccessible methods and functions, clients might receive errors for IAccessible interface pointers because - /// of a user action. For more information, see Receiving Errors for IAccessible Interface Pointers. + /// As with other IAccessible methods and functions, clients might receive errors for IAccessible interface pointers because of a + /// user action. For more information, see Receiving Errors for IAccessible Interface Pointers. /// /// - /// Clients use this function to obtain access to the Microsoft Office 2000 native object model. The native object model provides - /// clients with accessibility information about an Office application's document or client area that is not exposed by Microsoft - /// Active Accessibility. + /// Clients use this function to obtain access to the Microsoft Office 2000 native object model. The native object model provides clients + /// with accessibility information about an Office application's document or client area that is not exposed by Microsoft Active Accessibility. /// /// - /// To obtain an IDispatch interface pointer to a class supported by the native object model, specify OBJID_NATIVEOM in dwObjectID. - /// When using this object identifier, the hwnd parameter must match the following window class types. + /// To obtain an IDispatch interface pointer to a class supported by the native object model, specify OBJID_NATIVEOM in dwObjectID. When + /// using this object identifier, the hwnd parameter must match the following window class types. /// /// /// @@ -467,20 +577,20 @@ public static partial class Oleacc /// /// /// - /// Note that the above window classes correspond to the innermost document window or pane window. For more information about the - /// Office object model, see the Microsoft Office 2000/Visual Basic Programmer's Guide. + /// Note that the above window classes correspond to the innermost document window or pane window. For more information about the Office + /// object model, see the Microsoft Office 2000/Visual Basic Programmer's Guide. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-accessibleobjectfromwindow HRESULT - // AccessibleObjectFromWindow( HWND hwnd, DWORD dwId, REFIID riid, void **ppvObject ); + // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-accessibleobjectfromwindow HRESULT AccessibleObjectFromWindow( + // HWND hwnd, DWORD dwId, REFIID riid, void **ppvObject ); [DllImport(Lib.Oleacc, SetLastError = false, ExactSpelling = true)] [PInvokeData("oleacc.h", MSDNShortId = "297ac50f-2a58-477b-ba57-5d1416c191b3")] public static extern HRESULT AccessibleObjectFromWindow(HWND hwnd, uint dwId, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 2)] out object ppvObject); /// - /// Allows an assistive technology (AT) application to notify the system that it is interacting with UI through a Windows Automation - /// API (such as Microsoft UI Automation) as a result of a touch gesture from the user. This allows the assistive technology to - /// notify the target application and the system that the user is interacting with touch. + /// Allows an assistive technology (AT) application to notify the system that it is interacting with UI through a Windows Automation API + /// (such as Microsoft UI Automation) as a result of a touch gesture from the user. This allows the assistive technology to notify the + /// target application and the system that the user is interacting with touch. /// /// A window that belongs to the AT process that is calling AccNotifyTouchInteraction. /// The nearest window of the automation element that the AT is targeting. @@ -492,14 +602,14 @@ public static partial class Oleacc /// /// /// This function requires the calling process to have UIAccess or higher privileges. If the caller does not have the required - /// privileges, the call to AccNotifyTouchInteraction fails and returns E_ACCESSDENIED. For more information, see - /// Security Considerations for Assistive Technologies and /MANIFESTUAC (Embeds UAC information in manifest). + /// privileges, the call to AccNotifyTouchInteraction fails and returns E_ACCESSDENIED. For more information, see Security + /// Considerations for Assistive Technologies and /MANIFESTUAC (Embeds UAC information in manifest). /// /// - /// When an AT is consuming touch data (such as when using the RegisterPointerInputTarget function), the shell and applications that - /// the AT interacts with through the Windows Automation API are not aware that the user is interacting through touch. For the system - /// to expose touch-related functionality to the user, the AT must use AccNotifyTouchInteraction to notify the system that it - /// is performing the interaction in response to user touch input. + /// When an AT is consuming touch data (such as when using the RegisterPointerInputTarget function), the shell and applications that the + /// AT interacts with through the Windows Automation API are not aware that the user is interacting through touch. For the system to + /// expose touch-related functionality to the user, the AT must use AccNotifyTouchInteraction to notify the system that it is + /// performing the interaction in response to user touch input. /// /// Examples /// This code example shows how to call the AccNotifyTouchInteraction function. @@ -529,8 +639,8 @@ public static partial class Oleacc /// /// Type: DWORD /// - /// The new settings for the system values indicated by dwUtilityStateMask. This parameter can be zero to reset the system values, or - /// a combination of the following values. + /// The new settings for the system values indicated by dwUtilityStateMask. This parameter can be zero to reset the system values, or a + /// combination of the following values. /// /// /// @@ -548,8 +658,8 @@ public static partial class Oleacc /// /// ANRUS_PRIORITY_AUDIO_ACTIVE 0x0000004 /// - /// The AT application is relying on audio (such as text-to-speech) to convey essential information to the user and should remain - /// audible over other system sounds. + /// The AT application is relying on audio (such as text-to-speech) to convey essential information to the user and should remain audible + /// over other system sounds. /// /// /// @@ -570,8 +680,8 @@ public static partial class Oleacc /// Before it exits, an AT application should reset any system values that it previously set. /// /// This function requires the calling process to have UIAccess or higher privileges. If the caller does not have the required - /// privileges, the call to AccSetRunningUtilityState fails and returns E_ACCESSDENIED. For more information, see - /// Security Considerations for Assistive Technologies and /MANIFESTUAC (Embeds UAC information in manifest). + /// privileges, the call to AccSetRunningUtilityState fails and returns E_ACCESSDENIED. For more information, see Security + /// Considerations for Assistive Technologies and /MANIFESTUAC (Embeds UAC information in manifest). /// /// Examples /// This code example shows how to call the AccSetRunningUtilityState function. @@ -612,11 +722,11 @@ public static partial class Oleacc /// /// /// Server applications call this function when they contain a custom UI object that is similar to a system-provided object. Server - /// developers can call CreateStdAccessibleObject to override the IAccessible methods and properties as required to match - /// their custom objects. Alternatively, server developers can use Dynamic Annotation to override specific properties without having - /// to use difficult subclassing techniques that CreateStdAccessibleObject requires. Server developers should still use - /// CreateStdAccessibleObject for structural changes, such as hiding a child element or creating a placeholder child element. - /// This approach saves server developers the work of fully implementing all of the IAccessible properties and methods. + /// developers can call CreateStdAccessibleObject to override the IAccessible methods and properties as required to match their + /// custom objects. Alternatively, server developers can use Dynamic Annotation to override specific properties without having to use + /// difficult subclassing techniques that CreateStdAccessibleObject requires. Server developers should still use + /// CreateStdAccessibleObject for structural changes, such as hiding a child element or creating a placeholder child element. This + /// approach saves server developers the work of fully implementing all of the IAccessible properties and methods. /// /// /// This function is similar to CreateStdAccessibleProxy, except that CreateStdAccessibleProxy allows you to specify the class @@ -639,9 +749,9 @@ public static partial class Oleacc /// /// Type: LPCTSTR /// - /// Pointer to a null-terminated string of the class name of a system-provided user interface element for which an accessible object - /// is created. The window class name is one of the common controls (defined in Comctl32.dll), predefined controls (defined in - /// User32.dll), or window elements. + /// Pointer to a null-terminated string of the class name of a system-provided user interface element for which an accessible object is + /// created. The window class name is one of the common controls (defined in Comctl32.dll), predefined controls (defined in User32.dll), + /// or window elements. /// /// /// @@ -669,11 +779,11 @@ public static partial class Oleacc /// /// /// Server applications call this function when they contain a custom control that is similar to a system-provided control. Server - /// applications can call CreateStdAccessibleProxy to override the IAccessible methods and properties as required to match - /// their custom controls. Alternatively, server developers can use Dynamic Annotation to override specific properties without having - /// to use difficult subclassing techniques that were required with CreateStdAccessibleProxy. Server developers should still - /// use CreateStdAccessibleProxy for structural changes, such as hiding a child element or creating a placeholder child - /// element. This approach saves server developers the work of fully implementing all of the IAccessible properties and methods. + /// applications can call CreateStdAccessibleProxy to override the IAccessible methods and properties as required to match their + /// custom controls. Alternatively, server developers can use Dynamic Annotation to override specific properties without having to use + /// difficult subclassing techniques that were required with CreateStdAccessibleProxy. Server developers should still use + /// CreateStdAccessibleProxy for structural changes, such as hiding a child element or creating a placeholder child element. This + /// approach saves server developers the work of fully implementing all of the IAccessible properties and methods. /// /// /// This function is similar to CreateStdAccessibleObject, except that CreateStdAccessibleObject always uses the class name @@ -682,8 +792,8 @@ public static partial class Oleacc /// /// Use CreateStdAccessibleProxy to create an accessible object for a user interface element that is superclassed. When a user /// interface element is superclassed, an application creates a custom control with a window class name different from the predefined - /// control on which it is based. Because the class name associated with the hwnd parameter is the superclass window class name, - /// specify the base class name (the system class name on which the superclassed control is based) in pszClassName. + /// control on which it is based. Because the class name associated with the hwnd parameter is the superclass window class name, specify + /// the base class name (the system class name on which the superclassed control is based) in pszClassName. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-createstdaccessibleproxya HRESULT CreateStdAccessibleProxyA( @@ -727,26 +837,25 @@ public static partial class Oleacc /// /// /// In previous versions of the operating system, a process could open another process (to access its memory, for example) using - /// OpenProcess. This function succeeds if the caller has appropriate privileges; usually the caller and target process must - /// be the same user. + /// OpenProcess. This function succeeds if the caller has appropriate privileges; usually the caller and target process must be + /// the same user. /// /// /// On Windows Vista, however, OpenProcess fails in the scenario where the caller has UIAccess, and the target process is - /// elevated. In this case, the owner of the target process is in the Administrators group, but the calling process is running with - /// the restricted token, so does not have membership in this group, and is denied access to the elevated process. If the caller has + /// elevated. In this case, the owner of the target process is in the Administrators group, but the calling process is running with the + /// restricted token, so does not have membership in this group, and is denied access to the elevated process. If the caller has /// UIAccess, however, they can use a windows hook to inject code into the target process, and from within the target process, send a /// handle back to the caller. /// /// - /// GetProcessHandleFromHwnd is a convenience function that uses this technique to obtain the handle of the process that owns - /// the specified HWND. Note that it only succeeds in cases where the caller and target process are running as the same user. The - /// returned handle has the following privileges: PROCESS_DUP_HANDLE | PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE | - /// SYNCHRONIZE. If other privileges are required, it may be necessary to implement the hooking technique explicitly instead of using - /// this function. + /// GetProcessHandleFromHwnd is a convenience function that uses this technique to obtain the handle of the process that owns the + /// specified HWND. Note that it only succeeds in cases where the caller and target process are running as the same user. The returned + /// handle has the following privileges: PROCESS_DUP_HANDLE | PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE | SYNCHRONIZE. If + /// other privileges are required, it may be necessary to implement the hooking technique explicitly instead of using this function. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/WinAuto/getprocesshandlefromhwnd HANDLE WINAPI GetProcessHandleFromHwnd( _In_ - // HWND hwnd ); + // https://docs.microsoft.com/en-us/windows/desktop/WinAuto/getprocesshandlefromhwnd HANDLE WINAPI GetProcessHandleFromHwnd( _In_ HWND + // hwnd ); [DllImport(Lib.Oleacc, SetLastError = false, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "173579d2-c930-402c-81c7-761b063b5b51")] public static extern HPROCESS GetProcessHandleFromHwnd(HWND hwnd); @@ -766,8 +875,8 @@ public static partial class Oleacc /// /// Type: UINT /// - /// The size of the buffer that is pointed to by the lpszRole parameter. For ANSI strings, this value is measured in bytes; for - /// Unicode strings, it is measured in characters. + /// The size of the buffer that is pointed to by the lpszRole parameter. For ANSI strings, this value is measured in bytes; for Unicode + /// strings, it is measured in characters. /// /// /// @@ -799,8 +908,8 @@ public static partial class Oleacc /// /// Type: LPTSTR /// - /// Address of a buffer that receives the state text string. If this parameter is NULL, the function returns the state - /// string's length, not including the null character. + /// Address of a buffer that receives the state text string. If this parameter is NULL, the function returns the state string's + /// length, not including the null character. /// /// /// @@ -813,13 +922,13 @@ public static partial class Oleacc /// /// Type: UINT /// - /// If successful, and if lpszStateBit is non- NULL, the return value is the number of bytes (ANSI strings) or characters - /// (Unicode strings) that are copied into the buffer, not including the null-terminated character. If lpszStateBit is NULL, - /// the return value represents the string's length, not including the null character. + /// If successful, and if lpszStateBit is non- NULL, the return value is the number of bytes (ANSI strings) or characters (Unicode + /// strings) that are copied into the buffer, not including the null-terminated character. If lpszStateBit is NULL, the return + /// value represents the string's length, not including the null character. /// /// - /// If the string resource does not exist, or if the lpszStateBit parameter is not a valid pointer, the return value is zero (0). To - /// get extended error information, call GetLastError. + /// If the string resource does not exist, or if the lpszStateBit parameter is not a valid pointer, the return value is zero (0). To get + /// extended error information, call GetLastError. /// /// /// This function accepts only one state bit at a time, not a bitmask. @@ -871,24 +980,24 @@ public static partial class Oleacc /// /// /// - /// Servers call this function only when handling the WM_GETOBJECT message. For an overview of how LresultFromObject is - /// related to WM_GETOBJECT, see How WM_GETOBJECT Works. + /// Servers call this function only when handling the WM_GETOBJECT message. For an overview of how LresultFromObject is related to + /// WM_GETOBJECT, see How WM_GETOBJECT Works. /// /// - /// LresultFromObject increments the object's reference count. If you are not storing the interface pointer passed to the - /// function (that is, you create a new interface pointer for the object each time WM_GETOBJECT is received), call the object's - /// Release method to decrement the reference count back to one. Then the client calls Release and the object is destroyed. - /// For more information, see How to Handle WM_GETOBJECT. + /// LresultFromObject increments the object's reference count. If you are not storing the interface pointer passed to the function + /// (that is, you create a new interface pointer for the object each time WM_GETOBJECT is received), call the object's Release method to + /// decrement the reference count back to one. Then the client calls Release and the object is destroyed. For more information, + /// see How to Handle WM_GETOBJECT. /// /// - /// Each time a server processes WM_GETOBJECT for a specific object, it calls LresultFromObject to obtain a new reference to - /// the object. Servers do not save the reference returned from LresultFromObject from one instance of processing - /// WM_GETOBJECT to use as the message's return value when processing subsequent WM_GETOBJECT messages for the same - /// object. This causes the client to receive an error. + /// Each time a server processes WM_GETOBJECT for a specific object, it calls LresultFromObject to obtain a new reference to the + /// object. Servers do not save the reference returned from LresultFromObject from one instance of processing WM_GETOBJECT + /// to use as the message's return value when processing subsequent WM_GETOBJECT messages for the same object. This causes the + /// client to receive an error. /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-lresultfromobject LRESULT LresultFromObject( REFIID riid, - // WPARAM wParam, LPUNKNOWN punk ); + // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-lresultfromobject LRESULT LresultFromObject( REFIID riid, WPARAM + // wParam, LPUNKNOWN punk ); [DllImport(Lib.Oleacc, SetLastError = false, ExactSpelling = true)] [PInvokeData("oleacc.h", MSDNShortId = "c219a4cd-7a8f-4942-8975-b3d823b6497f")] public static extern IntPtr LresultFromObject(in Guid riid, IntPtr wParam, [In, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object punk); @@ -946,8 +1055,8 @@ public static partial class Oleacc /// /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-objectfromlresult HRESULT ObjectFromLresult( LRESULT - // lResult, REFIID riid, WPARAM wParam, void **ppvObject ); + // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-objectfromlresult HRESULT ObjectFromLresult( LRESULT lResult, + // REFIID riid, WPARAM wParam, void **ppvObject ); [DllImport(Lib.Oleacc, SetLastError = false, ExactSpelling = true)] [PInvokeData("oleacc.h", MSDNShortId = "97e766fd-e142-40d1-aba7-408b45d33426")] public static extern HRESULT ObjectFromLresult(IntPtr lResult, in Guid riid, IntPtr wParam, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object ppvObject); @@ -979,8 +1088,8 @@ public static partial class Oleacc /// /// /// - // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-windowfromaccessibleobject HRESULT - // WindowFromAccessibleObject( IAccessible *, HWND *phwnd ); + // https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-windowfromaccessibleobject HRESULT WindowFromAccessibleObject( + // IAccessible *, HWND *phwnd ); [DllImport(Lib.Oleacc, SetLastError = false, ExactSpelling = true)] [PInvokeData("oleacc.h", MSDNShortId = "b3a3d3dd-ef84-4323-ab6d-6331d8389f11")] public static extern HRESULT WindowFromAccessibleObject([In] IAccessible arg1, out HWND phwnd); diff --git a/PInvoke/ComCtl32/CommCtrl.Edit.cs b/PInvoke/ComCtl32/CommCtrl.Edit.cs index 002f62a4..ce58b006 100644 --- a/PInvoke/ComCtl32/CommCtrl.Edit.cs +++ b/PInvoke/ComCtl32/CommCtrl.Edit.cs @@ -1,38 +1,6 @@ -using System.Runtime.InteropServices; - namespace Vanara.PInvoke; public static partial class ComCtl32 { - /// Contains information about a balloon tip associated with a button control. - [PInvokeData("Commctrl.h", MSDNShortId = "bb775466")] - [StructLayout(LayoutKind.Sequential)] - public struct EDITBALLOONTIP - { - /// A DWORD that contains the size, in bytes, of the structure. - public int cbStruct; - - /// A pointer to a Unicode string that contains the title of the balloon tip. - [MarshalAs(UnmanagedType.LPWStr)] - public string pszTitle; - - /// A pointer to a Unicode string that contains the balloon tip text. - [MarshalAs(UnmanagedType.LPWStr)] - public string pszText; - - /// A value of type INT that specifies the type of icon to associate with the balloon tip. - public ToolTipIcon ttiIcon; - - /// Initializes a new instance of the struct. - /// The title. - /// The text. - /// The icon. - public EDITBALLOONTIP(string title, string text, ToolTipIcon icon = ToolTipIcon.TTI_NONE) - { - cbStruct = Marshal.SizeOf(typeof(EDITBALLOONTIP)); - pszText = text; - pszTitle = title; - ttiIcon = icon; - } - } + // Moved all content to WinUser.Edit.cs } \ No newline at end of file diff --git a/PInvoke/MsftEdit/RichEdit.cs b/PInvoke/MsftEdit/RichEdit.cs index 60562a7b..6ad3c575 100644 --- a/PInvoke/MsftEdit/RichEdit.cs +++ b/PInvoke/MsftEdit/RichEdit.cs @@ -4,7 +4,6 @@ using System.Runtime.InteropServices.ComTypes; using System.Text; using Vanara.Extensions; using Vanara.InteropServices; -using static Vanara.PInvoke.Ole32; using static Vanara.PInvoke.User32; namespace Vanara.PInvoke; @@ -15,6 +14,22 @@ public static partial class MsftEdit private const string Lib_msftedit = "msftedit.dll"; private const string Lib_Riched20 = "riched20.dll"; + /// For Microsoft Rich Edit 4.1 (Msftedit.dll), specify MSFTEDIT_CLASS as the window class. + public const string MSFTEDIT_CLASS = "RICHEDIT50W"; + + /// For all previous versions, specify RICHEDIT_CLASS for the Rich Edit class name. + public static readonly string RICHEDIT_CLASS = "RichEdit20" + (Marshal.SystemDefaultCharSize == 1 ? "A" : "W"); + + /// The rich edit 1.0 class. + public const string RICHEDIT_CLASS10A = "RichEdit10"; + + /// Initializes the current thread to use the Rich Edit control. + public static void MsftEditThreadInit() + { + Ole32.OleInitialize(IntPtr.Zero); + Kernel32.LoadLibrary(Lib_msftedit); + } + /// /// /// The AutoCorrectProc function is an application-defined callback function that is used with the EM_SETAUTOCORRECTPROC message. @@ -1063,6 +1078,3143 @@ public static partial class MsftEdit PFNS_NEWNUMBER = 0x8000, } + /// Messages specific to the rich edit control. + // https://learn.microsoft.com/en-us/windows/win32/controls/bumper-rich-edit-control-reference-messages + [PInvokeData("richedit.h")] + public enum RichEditMessage + { + /// Determines whether a rich edit control can paste a specified clipboard format. + /// + /// Parameters + /// + /// wParam + /// Specifies the Clipboard Formats to try. To try any format currently on the clipboard, set this parameter to zero. + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// If the clipboard format can be pasted, the return value is a nonzero value. + /// If the clipboard format cannot be pasted, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-canpaste + [MsgParams(typeof(CLIPFORMAT), null, LResultType = typeof(CLIPFORMAT))] + EM_CANPASTE = WindowMessage.WM_USER + 50, + /// Displays a portion of the contents of a rich edit control, as previously formatted for a device using the EM_FORMATRANGE message. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// A RECT structure specifying the display area of the device. + /// + /// Returns + /// + /// If the operation succeeds, the return value is TRUE. + /// If the operation fails, the return value is FALSE. + /// + /// Text and Component Object Model (COM) objects are clipped by the rectangle. The application does not need to set the clipping region. + /// Banding is the process by which a single page of output is generated using one or more separate rectangles, or bands. When all bands are placed on the page, a complete image results. This approach is often used by raster printers that do not have sufficient memory or ability to image a full page at one time. Banding devices include most dot matrix printers as well as some laser printers. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-displayband + [MsgParams(null, typeof(RECT?), LResultType = typeof(BOOL))] + EM_DISPLAYBAND = WindowMessage.WM_USER + 51, + /// Retrieves the starting and ending character positions of the selection in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// A CHARRANGE structure that receives the selection range. + /// + /// Returns + /// + /// This message does not return a value. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-exgetsel + [MsgParams(null, typeof(CHARRANGE?), LResultType = null)] + EM_EXGETSEL = WindowMessage.WM_USER + 52, + /// Sets an upper limit to the amount of text the user can type or paste into a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Specifies the maximum amount of text that can be entered. If this parameter is zero, the default maximum is used, which is 64K characters. A COM object counts as a single character. + /// + /// Returns + /// + /// This message does not return a value. + /// + /// The text limit set by the EM_EXLIMITTEXT message does not limit the amount of text that you can stream into a rich edit control using the EM_STREAMIN message with lParam set to SF_TEXT. However, it does limit the amount of text that you can stream into a rich edit control using the EM_STREAMIN message with lParam set to SF_RTF. + /// Before EM_EXLIMITTEXT is called, the default limit to the amount of text a user can enter is 32,767 characters. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-exlimittext + [MsgParams(null, typeof(uint), LResultType = null)] + EM_EXLIMITTEXT = WindowMessage.WM_USER + 53, + /// Determines which line contains the specified character in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Zero-based index of the character. + /// + /// Returns + /// + /// This message returns the zero-based index of the line. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-exlinefromchar + [MsgParams(null, typeof(uint), LResultType = typeof(uint))] + EM_EXLINEFROMCHAR = WindowMessage.WM_USER + 54, + /// Selects a range of characters or Component Object Model (COM) objects in a Microsoft Rich Edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// A CHARRANGE structure that specifies the selection range. + /// + /// Returns + /// + /// The return value is the selection that is actually set. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-exsetsel + [MsgParams(null, typeof(CHARRANGE?), LResultType = typeof(CHARRANGE?))] + EM_EXSETSEL = WindowMessage.WM_USER + 55, + /// Finds text within a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specify the parameters of the search operation. This parameter can be one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// FR_DOWN + /// Microsoft Rich Edit 2.0 and later: If set, the search is from the end of the current selection to the end of the document. If not set, the search is from the end of the current selection to the beginning of the document. Microsoft Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always from the end of the current selection to the end of the document. + /// + /// + /// FR_MATCHALEFHAMZA + /// Microsoft Rich Edit 3.0 and later: If set, the search differentiates between Arabic alefs with different accents. If not set, all alefs are matched by the alef character alone. + /// + /// + /// FR_MATCHDIAC + /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic and Hebrew diacritical marks. If not set, diacritical marks are ignored. + /// + /// + /// FR_MATCHKASHIDA + /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic kashidas. If not set, kashidas are ignored. + /// + /// + /// FR_MATCHWIDTH + /// Windows 8: If set, single-byte and double-byte versions of the same character are considered to be not equal. + /// + /// + /// FR_WHOLEWORD + /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for word fragments that match the search string. + /// + /// + /// lParam + /// A FINDTEXT structure containing information about the find operation. + /// + /// Returns + /// + /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is not found, the return value is -1. + /// The cpMin member of FINDTEXT.chrg always specifies the starting-point of the search, and cpMax specifies the end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a value of -1 in cpMax extends the search range to the end of the text. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtext + [MsgParams(typeof(FR), typeof(FINDTEXT), LResultType = typeof(int))] + EM_FINDTEXT = WindowMessage.WM_USER + 56, + /// Formats a range of text in a rich edit control for a specific device. + /// + /// Parameters + /// + /// wParam + /// Specifies whether to render the text. If this parameter is not zero, the text is rendered. Otherwise, the text is just measured. + /// lParam + /// A FORMATRANGE structure containing information about the output device, or NULL to free information cached by the control. + /// + /// Returns + /// + /// This message returns the index of the last character that fits in the region, plus 1. + /// + /// This message is typically used to format the content of rich edit control for an output device such as a printer. + /// After using this message to format a range of text, it is important that you free cached information by sending EM_FORMATRANGE again, but with lParam set to NULL; otherwise, a memory leak will occur. Also, after using this message for one device, you must free cached information before using it again for a different device. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-formatrange + EM_FORMATRANGE = WindowMessage.WM_USER + 57, + /// Determines the character formatting in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the range of text from which to retrieve formatting. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SCF_DEFAULT + /// The default character formatting. + /// + /// + /// SCF_SELECTION + /// The current selection's character formatting. + /// + /// + /// lParam + /// A CHARFORMAT structure that receives the attributes of the first character. The dwMask member specifies which attributes are consistent throughout the entire selection. For example, if the entire selection is either in italics or not in italics, CFM_ITALIC is set; if the selection is partly in italics and partly not, CFM_ITALIC is not set. + /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a CHARFORMAT2 structure, which is an extension of the CHARFORMAT structure. Before sending the EM_GETCHARFORMAT message, set the structure's cbSize member to indicate the version of the structure. + /// + /// Returns + /// + /// This message returns the value of the dwMask member of the CHARFORMAT structure. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getcharformat + EM_GETCHARFORMAT = WindowMessage.WM_USER + 58, + /// Retrieves the event mask for a rich edit control. The event mask specifies which notification codes the control sends to its parent window. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// This message returns the event mask for the rich edit control. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-geteventmask + EM_GETEVENTMASK = WindowMessage.WM_USER + 59, + + /// Retrieves an IRichEditOle object that a client can use to access a rich edit control's Component Object Model (COM) functionality. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a pointer that receives the IRichEditOle object. The control calls the AddRef method for the object before returning, so the calling application must call the Release method when it is done with the object. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getoleinterface + EM_GETOLEINTERFACE = WindowMessage.WM_USER + 60, + /// Retrieves the paragraph formatting of the current selection in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a PARAFORMAT structure that receives the paragraph formatting attributes of the current selection. + /// If more than one paragraph is selected, the structure receives the attributes of the first paragraph, and the dwMask member specifies which attributes are consistent throughout the entire selection. + /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a PARAFORMAT2 structure, which is an extension of the PARAFORMAT structure. Before sending the EM_GETPARAFORMAT message, set the structure's cbSize member to indicate the version of the structure. + /// + /// Returns + /// + /// This message returns the value of the dwMask member of the PARAFORMAT structure. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getparaformat + EM_GETPARAFORMAT = WindowMessage.WM_USER + 61, + /// Retrieves the currently selected text in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a buffer that receives the selected text. The calling application must ensure that the buffer is large enough to hold the selected text. + /// + /// Returns + /// + /// This message returns the number of characters copied, not including the terminating null character. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getseltext + EM_GETSELTEXT = WindowMessage.WM_USER + 62, + /// The EM_HIDESELECTION message hides or shows the selection in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Value specifying whether to hide or show the selection. If this parameter is zero, the selection is shown. Otherwise, the selection is hidden. + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// This message does not return a value. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-hideselection + EM_HIDESELECTION = WindowMessage.WM_USER + 63, + /// Pastes a specific clipboard format in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the Clipboard Formats. + /// lParam + /// Pointer to a REPASTESPECIAL structure or NULL. If an object is being pasted, the REPASTESPECIAL structure is filled in with the desired display aspect. If lParam is NULL or the dwAspect member is zero, the display aspect used will be the contents of the object descriptor. + /// + /// Returns + /// + /// This message does not return a value. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-pastespecial + EM_PASTESPECIAL = WindowMessage.WM_USER + 64, + /// Forces a rich edit control to send an EN_REQUESTRESIZE notification code to its parent window. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// This message does not return a value. + /// This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-requestresize + EM_REQUESTRESIZE = WindowMessage.WM_USER + 65, + /// Determines the selection type for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If the selection is empty, the return value is SEL_EMPTY. + /// If the selection is not empty, the return value is a set of flags containing one or more of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// SEL_TEXT + /// Text. + /// + /// + /// SEL_OBJECT + /// At least one COM object. + /// + /// + /// SEL_MULTICHAR + /// More than one character of text. + /// + /// + /// SEL_MULTIOBJECT + /// More than one COM object. + /// + /// + /// This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-selectiontype + EM_SELECTIONTYPE = WindowMessage.WM_USER + 66, + /// The EM_SETBKGNDCOLOR message sets the background color for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies whether to use the system color. If this parameter is a nonzero value, the background is set to the window background system color. Otherwise, the background is set to the specified color. + /// lParam + /// A COLORREF structure specifying the color if wParam is zero. To generate a COLORREF, use the RGB macro. + /// + /// Returns + /// + /// This message returns the original background color. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setbkgndcolor + EM_SETBKGNDCOLOR = WindowMessage.WM_USER + 67, + /// Sets character formatting in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Character formatting that applies to the control. If this parameter is zero, the default character format is set. Otherwise, it can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SCF_ALL + /// Applies the formatting to all text in the control. Not valid with SCF_SELECTION or SCF_WORD. + /// + /// + /// SCF_ASSOCIATEFONT + /// RichEdit 4.1: Associates a font to a given script, thus changing the default font for that script. To specify the font, use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. + /// + /// + /// SCF_ASSOCIATEFONT2 + /// RichEdit 4.1: Associates a surrogate (plane-2) font to a given script, thus changing the default font for that script. To specify the font, use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. + /// + /// + /// SCF_CHARREPFROMLCID + /// Gets the character repertoire from the LCID. + /// + /// + /// SCF_DEFAULT + /// RichEdit 4.1: Sets the default font for the control. + /// + /// + /// SPF_DONTSETDEFAULT + /// Prevents setting the default paragraph format when the rich edit control is empty. + /// + /// + /// SCF_NOKBUPDATE + /// RichEdit 4.1: Prevents keyboard switching to match the font. For example, if an Arabic font is set, normally the automatic keyboard feature for Bidi languages changes the keyboard to an Arabic keyboard. + /// + /// + /// SCF_SELECTION + /// Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion point, and the new character format is in effect only until the insertion point changes. + /// + /// + /// SPF_SETDEFAULT + /// Sets the default paragraph formatting attributes. + /// + /// + /// SCF_SMARTFONT + /// Apply the font only if it can handle script. + /// + /// + /// SCF_USEUIRULES + /// RichEdit 4.1: Used with SCF_SELECTION. Indicates that format came from a toolbar or other UI tool, so UI formatting rules should be used instead of literal formatting. + /// + /// + /// SCF_WORD + /// Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the formatting is applied to the word. The SCF_WORD value must be used in conjunction with the SCF_SELECTION value. + /// + /// + /// lParam + /// Pointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by the dwMask member are changed. + /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a CHARFORMAT2 structure, which is an extension of the CHARFORMAT structure. Before sending the EM_SETCHARFORMAT message, set the structure's cbSize member to or indicate which version of the structure is being used. + /// The szFaceName and bCharSet members may be overruled when invalid for characters, for example: Arial on kanji characters. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + /// If this message is sent more than once with the same parameters, the effect on the text is toggled. That is, sending the message once produces the effect, sending the message twice cancels the effect, and so forth. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setcharformat + EM_SETCHARFORMAT = WindowMessage.WM_USER + 68, + /// Sets the event mask for a rich edit control. The event mask specifies which notification codes the control sends to its parent window. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// New event mask for the rich edit control. For a list of event masks, see Rich Edit Control Event Mask Flags. + /// + /// Returns + /// + /// This message returns the previous event mask. + /// The default event mask (before any is set) is ENM_NONE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-seteventmask + EM_SETEVENTMASK = WindowMessage.WM_USER + 69, + /// Gives a rich edit control an IRichEditOleCallback object that the control uses to get OLE-related resources and information from the client. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to an IRichEditOleCallback object. The control calls the AddRef method for the object before returning. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setolecallback + EM_SETOLECALLBACK = WindowMessage.WM_USER + 70, + /// Sets the paragraph formatting for the current selection in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a PARAFORMAT structure specifying the new paragraph formatting attributes. Only the attributes specified by the dwMask member are changed. + /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a PARAFORMAT2 structure, which is an extension of the PARAFORMAT structure. Before sending the EM_SETPARAFORMAT message, set the structure's cbSize member to indicate the version of the structure. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setparaformat + EM_SETPARAFORMAT = WindowMessage.WM_USER + 71, + /// Sets the target device and line width used for "what you see is what you get" (WYSIWYG) formatting in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// HDC for the target device. + /// lParam + /// Line width to use for formatting. + /// + /// Returns + /// + /// The return value is zero if the operation fails, or nonzero if it succeeds. + /// + /// The HDC for the default printer can be obtained as follows. + /// If lParam is zero, no line breaks are created. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-settargetdevice + EM_SETTARGETDEVICE = WindowMessage.WM_USER + 72, + /// Replaces the contents of a rich edit control with a stream of data provided by an application defined EditStreamCallback callback function. + /// + /// Parameters + /// + /// wParam + /// Specifies the data format and replacement options. This value must be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SF_RTF + /// RTF + /// + /// + /// SF_TEXT + /// Text + /// + /// + /// In addition, you can specify the following flags. + /// + /// + /// Value + /// Meaning + /// + /// + /// SFF_PLAINRTF + /// If specified, only keywords common to all languages are streamed in. Language-specific RTF keywords in the stream are ignored. If not specified, all keywords are streamed in. You can combine this flag with the SF_RTF flag. + /// + /// + /// SFF_SELECTION + /// If specified, the data stream replaces the contents of the current selection. If not specified, the data stream replaces the entire contents of the control. You can combine this flag with the SF_TEXT or SF_RTF flags. + /// + /// + /// SF_UNICODE + /// Microsoft Rich Edit 2.0 and later: Indicates Unicode text. You can combine this flag with the SF_TEXT flag. + /// + /// + /// lParam + /// Pointer to an EDITSTREAM structure. On input, the pfnCallback member of this structure must point to an application defined EditStreamCallback function. On output, the dwError member can contain a nonzero error code if an error occurred. + /// + /// Returns + /// + /// This message returns the number of characters read. + /// When you send an EM_STREAMIN message, the rich edit control makes repeated calls to the EditStreamCallback function specified by the pfnCallback member of the EDITSTREAM structure. Each time the callback function is called, it fills a buffer with data to read into the control. This continues until the callback function indicates that the stream-in operation has been completed or an error occurs. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-streamin + EM_STREAMIN = WindowMessage.WM_USER + 73, + /// Causes a rich edit control to pass its contents to an application defined EditStreamCallback callback function. The callback function can then write the stream of data to a file or any other location that it chooses. + /// + /// Parameters + /// + /// wParam + /// Specifies the data format and replacement options. + /// This value must be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SF_RTF + /// RTF. + /// + /// + /// SF_RTFNOOBJS + /// RTF with spaces in place of COM objects. + /// + /// + /// SF_TEXT + /// Text with spaces in place of COM objects. + /// + /// + /// SF_TEXTIZED + /// Text with a text representation of COM objects. + /// + /// + /// The SF_RTFNOOBJS option is useful if an application stores COM objects itself, as RTF representation of COM objects is not very compact. The control word, \objattph, followed by a space denotes the object position. + /// In addition, you can specify the following flags. + /// + /// + /// Value + /// Meaning + /// + /// + /// SFF_PLAINRTF + /// If specified, the rich edit control streams out only the keywords common to all languages, ignoring language-specific keywords. If not specified, the rich edit control streams out all keywords. You can combine this flag with the SF_RTF or SF_RTFNOOBJS flag. + /// + /// + /// SFF_SELECTION + /// If specified, the rich edit control streams out only the contents of the current selection. If not specified, the control streams out the entire contents. You can combine this flag with any of data format values. + /// + /// + /// SF_UNICODE + /// Microsoft Rich Edit 2.0 and later: Indicates Unicode text. You can combine this flag with the SF_TEXT flag. + /// + /// + /// SF_USECODEPAGE + /// Rich Edit 3.0 and later: Generates UTF-8 RTF as well as text using other code pages. The code page is set in the high word of wParam. For example, for UTF-8 RTF, set wParam to (CP_UTF8 << 16) | SF_USECODEPAGE | SF_RTF. + /// + /// + /// lParam + /// Pointer to an EDITSTREAM structure. On input, the pfnCallback member of this structure must point to an application defined EditStreamCallback function. On output, the dwError member can contain a nonzero error code if an error occurred. + /// + /// Returns + /// + /// This message returns the number of characters written to the data stream. + /// When you send an EM_STREAMOUT message, the rich edit control makes repeated calls to the EditStreamCallback function specified by the pfnCallback member of the EDITSTREAM structure. Each time it calls the callback function, the control passes a buffer containing a portion of the contents of the control. This process continues until the control has passed all its contents to the callback function, or until an error occurs. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-streamout + EM_STREAMOUT = WindowMessage.WM_USER + 74, + /// Retrieves a specified range of characters from a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a TEXTRANGE structure that specifies the range of characters to retrieve and a buffer to copy the characters to. + /// + /// Returns + /// + /// The message returns the number of characters copied, not including the terminating null character. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextrange + EM_GETTEXTRANGE = WindowMessage.WM_USER + 75, + /// Finds the next word break before or after the specified character position or retrieves information about the character at that position. + /// + /// Parameters + /// + /// wParam + /// Specifies the find operation. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// WB_CLASSIFY + /// Returns the character class and word-break flags of the character at the specified position. + /// + /// + /// WB_ISDELIMITER + /// Returns TRUE if the character at the specified position is a delimiter, or FALSE otherwise. + /// + /// + /// WB_LEFT + /// Finds the nearest character before the specified position that begins a word. + /// + /// + /// WB_LEFTBREAK + /// Finds the next word end before the specified position. This value is the same as WB_PREVBREAK. + /// + /// + /// WB_MOVEWORDLEFT + /// Finds the next character that begins a word before the specified position. This value is used during CTRL+LEFT ARROW key processing. This value is the similar to WB_MOVEWORDPREV. See Remarks for more information. + /// + /// + /// WB_MOVEWORDRIGHT + /// Finds the next character that begins a word after the specified position. This value is used during CTRL+right key processing. This value is similar to WB_MOVEWORDNEXT. See Remarks for more information. + /// + /// + /// WB_RIGHT + /// Finds the next character that begins a word after the specified position. + /// + /// + /// WB_RIGHTBREAK + /// Finds the next end-of-word delimiter after the specified position. This value is the same as WB_NEXTBREAK. + /// + /// + /// lParam + /// Zero-based character starting position. + /// + /// Returns + /// + /// The message returns a value based on the wParam parameter. + /// + /// + /// Return code + /// Description + /// + /// + /// wParam + /// Return Value + /// + /// + /// WB_CLASSIFY + /// Returns the character class and word-break flags of the character at the specified position. + /// + /// + /// WB_ISDELIMITER + /// Returns TRUE if the character at the specified position is a delimiter; otherwise it returns FALSE. + /// + /// + /// Others + /// Returns the character index of the word break. + /// + /// + /// + /// If wParam is WB_LEFT and WB_RIGHT, the word-break procedure finds word breaks only after delimiters. This matches the functionality of an edit control. If wParam is WB_MOVEWORDLEFT or WB_MOVEWORDRIGHT, the word-break procedure also compares character classes and word-break flags. + /// For information about character classes and word-break flags, see Word and Line Breaks. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-findwordbreak + EM_FINDWORDBREAK = WindowMessage.WM_USER + 76, + /// Sets the options for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the operation, which can be one of these values. + /// + /// + /// Value + /// Meaning + /// + /// + /// ECOOP_SET + /// Sets the options to those specified by lParam. + /// + /// + /// ECOOP_OR + /// Combines the specified options with the current options. + /// + /// + /// ECOOP_AND + /// Retains only those current options that are also specified by lParam. + /// + /// + /// ECOOP_XOR + /// Logically exclusive OR the current options with those specified by lParam. + /// + /// + /// lParam + /// Specifies one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// ECO_AUTOWORDSELECTION + /// Automatic selection of word on double-click. + /// + /// + /// ECO_AUTOVSCROLL + /// Same as ES_AUTOVSCROLL style. + /// + /// + /// ECO_AUTOHSCROLL + /// Same as ES_AUTOHSCROLL style. + /// + /// + /// ECO_NOHIDESEL + /// Same as ES_NOHIDESEL style. + /// + /// + /// ECO_READONLY + /// Same as ES_READONLY style. + /// + /// + /// ECO_WANTRETURN + /// Same as ES_WANTRETURN style. + /// + /// + /// ECO_SELECTIONBAR + /// Same as ES_SELECTIONBAR style. + /// + /// + /// ECO_VERTICAL + /// Same as ES_VERTICAL style. Available in Asian-language versions only. + /// + /// + /// + /// Returns + /// + /// This message returns the current options of the edit control. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setoptions + EM_SETOPTIONS = WindowMessage.WM_USER + 77, + /// Retrieves rich edit control options. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// This message returns a combination of the current option flag values described in the EM_SETOPTIONS message. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getoptions + EM_GETOPTIONS = WindowMessage.WM_USER + 78, + /// Finds text within a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the behavior of the search operation. This parameter can be one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// FR_DOWN + /// Microsoft Rich Edit 2.0 and later: If set, the search is forward from FINDTEXTEX.chrg.cpMin; if not set, the search is backward from FINDTEXTEX.chrg.cpMin. Microsoft Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always forward. + /// + /// + /// FR_MATCHALEFHAMZA + /// Microsoft Rich Edit 3.0 and later: If set, the search differentiates between Arabic and Hebrew alefs with different accents. If not set, all alefs are matched by the alef character alone. + /// + /// + /// FR_MATCHCASE + /// If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive. + /// + /// + /// FR_MATCHDIAC + /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic and Hebrew diacritical marks. If not set, diacritical marks are ignored. + /// + /// + /// FR_MATCHKASHIDA + /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic and Hebrew kashidas. If not set, kashidas are ignored. + /// + /// + /// FR_WHOLEWORD + /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for word fragments that match the search string. + /// + /// + /// lParam + /// A FINDTEXTEX structure containing information about the find operation. + /// + /// Returns + /// + /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is not found, the return value is -1. + /// + /// Use this message to find ANSI strings. For Unicode, use EM_FINDTEXTEXW. + /// The cpMin member of FINDTEXTEX.chrg always specifies the starting-point of the search, and cpMax specifies the end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a value of -1 in cpMax extends the search range to the end of the text. + /// If the search operation finds a match, the chrgText member of the FINDTEXTEX structure returns the range of character positions that contains the matching text. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtextex + EM_FINDTEXTEX = WindowMessage.WM_USER + 79, + /// Retrieves the address of the currently registered extended word-break procedure for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The message returns the address of the current procedure. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getwordbreakprocex + EM_GETWORDBREAKPROCEX = WindowMessage.WM_USER + 80, + /// Sets the extended word-break procedure for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to an EditWordBreakProcEx function, or NULL to use the default procedure. + /// + /// Returns + /// + /// This message returns the address of the previous extended word-break procedure. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setwordbreakprocex + EM_SETWORDBREAKPROCEX = WindowMessage.WM_USER + 81, + /// Sets the maximum number of actions that can stored in the undo queue of a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the maximum number of actions that can be stored in the undo queue. + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// The return value is the new maximum number of undo actions for the rich edit control. This value may be less than wParam if memory is limited. + /// + /// By default, the maximum number of actions in the undo queue is 100. If you increase this number, there must be enough available memory to accommodate the new number. For better performance, set the limit to the smallest possible value. + /// Setting the limit to zero disables the Undo feature. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setundolimit + EM_SETUNDOLIMIT = WindowMessage.WM_USER + 82, + /// Sends an EM_REDO message to a rich edit control to redo the next action in the control's redo queue. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If the Redo operation succeeds, the return value is a nonzero value. + /// If the Redo operation fails, the return value is zero. + /// To determine whether there are any actions in the control's redo queue, send the EM_CANREDO message. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-redo + EM_REDO = WindowMessage.WM_USER + 84, + /// Determines whether there are any actions in the control redo queue. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If there are actions in the control redo queue, the return value is a nonzero value. + /// If the redo queue is empty, the return value is zero. + /// To redo the most recent undo operation, send the EM_REDO message. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-canredo + EM_CANREDO = WindowMessage.WM_USER + 85, + /// + /// Microsoft Rich Edit 2.0 and later: Retrieves the type of the next undo action, if any. + /// Microsoft Rich Edit 1.0: This message is not supported. + /// + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If there is an undo action, the value returned is an UNDONAMEID enumeration value that indicates the type of the next action in the control's undo queue. + /// If there are no actions that can be undone or the type of the next undo action is unknown, the return value is zero. + /// The types of actions that can be undone or redone include typing, delete, drag, drop, cut, and paste operations. This information can be useful for applications that provide an extended user interface for undo and redo operations, such as a drop-down list box of actions that can be undone. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getundoname + EM_GETUNDONAME = WindowMessage.WM_USER + 86, + /// Retrieves the type of the next action, if any, in the rich edit control's redo queue. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If the redo queue for the control is not empty, the value returned is an UNDONAMEID enumeration value that indicates the type of the next action in the control's redo queue. + /// If there are no redoable actions or the type of the next redoable action is unknown, the return value is zero. + /// The types of actions that can be undone or redone include typing, delete, drag-drop, cut, and paste operations. This information can be useful for applications that provide an extended user interface for undo and redo operations, such as a drop-down list box of redoable actions. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getredoname + EM_GETREDONAME = WindowMessage.WM_USER + 87, + /// Stops a rich edit control from collecting additional typing actions into the current undo action. The control stores the next typing action, if any, into a new action in the undo queue. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The return value is zero. This message cannot fail. + /// + /// A rich edit control groups consecutive typing actions, including characters deleted by using the BackSpace key, into a single undo action until one of the following events occurs: + /// + /// + /// The control receives an EM_STOPGROUPTYPING message. + /// + /// + /// The control loses focus. + /// + /// + /// The user moves the current selection, either by using the arrow keys or by clicking the mouse. + /// + /// + /// The user presses the Delete key. + /// + /// + /// The user performs any other action, such as a paste operation that does not involve typing. + /// + /// + /// You can send the EM_STOPGROUPTYPING message to break consecutive typing actions into smaller undo groups. For example, you could send EM_STOPGROUPTYPING after each character or at each word break. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-stopgrouptyping + EM_STOPGROUPTYPING = WindowMessage.WM_USER + 88, + /// Sets the text mode or undo level of a rich edit control. The message fails if the control contains any text. + /// + /// Parameters + /// + /// wParam + /// One or more values from the TEXTMODE enumeration type. The values specify the new settings for the control's text mode and undo level parameters. + /// Specify one of the following values to set the text mode parameter. If you do not specify a text mode value, the text mode remains at its current setting. + /// + /// + /// Value + /// Meaning + /// + /// + /// TM_PLAINTEXT + /// Indicates plain text mode, in which the control is similar to a standard edit control. For more information about plain text mode, see the following Remarks section. + /// + /// + /// TM_RICHTEXT + /// Indicates rich text mode, in which the control has standard rich edit functionality. Rich text mode is the default setting. + /// + /// + /// Specify one of the following values to set the undo level parameter. If you do not specify an undo level value, the undo level remains at its current setting. + /// + /// + /// Value + /// Meaning + /// + /// + /// TM_SINGLELEVELUNDO + /// The control allows the user to undo only the last action that can be undone. + /// + /// + /// TM_MULTILEVELUNDO + /// The control supports multiple undo operations. This is the default setting. Use the EM_SETUNDOLIMIT message to set the maximum number of undo actions. + /// + /// + /// Specify one of the following values to set the code page parameter. If you do not specify an code page value, the code page remains at its current setting. + /// + /// + /// Value + /// Meaning + /// + /// + /// TM_SINGLECODEPAGE + /// The control only allows the English keyboard and a keyboard corresponding to the default character set. For example, you could have Greek and English. Note that this prevents Unicode text from entering the control. For example, use this value if a Rich Edit control must be restricted to ANSI text. + /// + /// + /// TM_MULTICODEPAGE + /// The control allows multiple code pages and Unicode text into the control. This is the default setting. + /// + /// + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// If the message succeeds, the return value is zero. + /// If the message fails, the return value is a nonzero value. + /// + /// In rich text mode, a rich edit control has standard rich edit functionality. However, in plain text mode, the control is similar to a standard edit control: + /// + /// + /// The text in a plain text control can have only one format (such as Bold, 10pt Arial). + /// + /// + /// The user cannot paste rich text formats, such as Rich Text Format (RTF) or embedded objects into a plain text control. + /// + /// + /// Rich text mode controls always have a default end-of-document marker or carriage return, to format paragraphs. Plain text controls, on the other hand, do not need the default, end-of-document marker, so it is omitted. + /// + /// + /// The control must contain no text when it receives the EM_SETTEXTMODE message. To ensure there is no text, send a WM_SETTEXT message with an empty string (""). + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-settextmode + EM_SETTEXTMODE = WindowMessage.WM_USER + 89, + /// Gets the current text mode and undo level of a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The return value is one or more values from the TEXTMODE enumeration type. The values indicate the current text mode and undo level of the control. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextmode + EM_GETTEXTMODE = WindowMessage.WM_USER + 90, + /// Enables or disables automatic detection of hyperlinks by a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specify 0 to disable automatic link detection, or one of the following values to enable various kinds of detection. + /// + /// + /// Value + /// Meaning + /// + /// + /// AURL_DISABLEMIXEDLGC + /// Windows 8: Disable recognition of domain names that contain labels with characters belonging to more than one of the following scripts: Latin, Greek, and Cyrillic. + /// + /// + /// AURL_ENABLEDRIVELETTERS + /// Windows 8: Recognize file names that have a leading drive specification, such as c:\temp. + /// + /// + /// AURL_ENABLEEA + /// This value is deprecated; use AURL_ENABLEEAURLS instead. + /// + /// + /// AURL_ENABLEEAURLS + /// Recognize URLs that contain East Asian characters. + /// + /// + /// AURL_ENABLEEMAILADDR + /// Windows 8: Recognize email addresses. + /// + /// + /// AURL_ENABLETELNO + /// Windows 8: Recognize telephone numbers. + /// + /// + /// AURL_ENABLEURL + /// Windows 8: Recognize URLs that include the path. + /// + /// + /// lParam + /// This parameter determines the URL schemes recognized if AURL_ENABLEURL is active. If lParam is NULL, the default scheme name list is used (see Remarks). Alternatively, lParam can point to a null-terminated string consisting of up to 50 colon-terminated scheme names that supersede the default scheme name list. For example, the string could be "news:http:ftp:telnet:". The scheme name syntax is defined in the Uniform Resource Identifiers (URI): Generic Syntax document on The Internet Engineering Task Force (IETF) website. Specifically, a scheme name can contain up to 13 characters (including the colon), must start with an ASCII alphabetic, and can be followed by a mixture of ASCII alphabetics, digits, and the three punctuation characters: ".", "+", and "-". The string type can be either char* or WCHAR*; the rich edit control automatically detects the type. + /// + /// Returns + /// + /// If the message succeeds, the return value is zero. + /// If the message fails, the return value is a nonzero value. For example, the message might fail due to insufficient memory, an invalid detection option, or an invalid scheme-name string. + /// If lParam contains more than 50 scheme names, the message fails with a return value of E_INVALIDARG. + /// + /// If automatic URL detection is enabled (that is, wParam includes AURL_ENABLEURL), the rich edit control scans any modified text to determine whether the text matches the format of a URL (or more generally in Windows 8 or later an IRI International Resource Identifier). If lParam is NULL, the control detects URLs that begin with the following scheme names: + /// + /// + /// callto + /// + /// + /// file + /// + /// + /// ftp + /// + /// + /// gopher + /// + /// + /// http + /// + /// + /// https + /// + /// + /// mailto + /// + /// + /// news + /// + /// + /// notes + /// + /// + /// nntp + /// + /// + /// onenote + /// + /// + /// outlook + /// + /// + /// prospero + /// + /// + /// tel + /// + /// + /// telnet + /// + /// + /// wais + /// + /// + /// webcal + /// + /// + /// When automatic link detection is enabled, the rich edit control removes the CFE_LINK effect from modified text that does not have a format recognized by the control. If your application uses the CFE_LINK effect to mark other types of text, do not enable automatic link detection. The rich edit control does not check whether a detected link exists; that responsibility belongs to the client. + /// A rich edit control sends the EN_LINK notification when it receives various messages while the mouse pointer is over text that has the CFE_LINK effect. For more information, see Automatic RichEdit Hyperlinks and RichEdit Friendly Name Hyperlinks. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-autourldetect + EM_AUTOURLDETECT = WindowMessage.WM_USER + 91, + /// Indicates whether the auto URL detection is turned on in the rich edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If auto-URL detection is active, the return value is 1. + /// If auto-URL detection is inactive, the return value is 0. + /// + /// When auto URL detection is on, Microsoft Rich Edit is constantly checking typed text for a valid URL. Rich Edit recognizes URLs that start with these prefixes: + /// + /// + /// http: + /// + /// + /// file: + /// + /// + /// mailto: + /// + /// + /// ftp: + /// + /// + /// https: + /// + /// + /// gopher: + /// + /// + /// nntp: + /// + /// + /// prospero: + /// + /// + /// telnet: + /// + /// + /// news: + /// + /// + /// wais: + /// + /// + /// outlook: + /// + /// + /// Rich Edit also recognizes standard path names that start with \\. When Rich Edit locates a URL, it changes the URL text color, underlines the text, and notifies the client using EN_LINK. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getautourldetect + EM_GETAUTOURLDETECT = WindowMessage.WM_USER + 92, + /// Changes the palette that a rich edit control uses for its display window. + /// + /// Parameters + /// + /// wParam + /// Handle to the new palette used by the rich edit control. + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// This message does not return a value. + /// The rich edit control does not check whether the new palette is valid. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpalette + EM_SETPALETTE = WindowMessage.WM_USER + 93, + /// Gets the text from a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Pointer to a GETTEXTEX structure, which indicates how to translate the text before putting it into the output buffer. + /// lParam + /// Pointer to the buffer to receive the text. The size of this buffer, in bytes, is specified by the cb member of the GETTEXTEX structure. Use the EM_GETTEXTLENGTHEX message to get the required size of the buffer. + /// + /// Returns + /// + /// The return value is the number of TCHARs copied into the output buffer, not including the null terminator. + /// + /// If the size of the output buffer is less than the size of the text in the control, the edit control will copy text from its beginning and place it in the buffer until the buffer is full. A terminating null character will still be placed at the end of the buffer. + /// If ANSI text is requested, EM_GETTEXTEX uses the WideCharToMultiByte function to translate the Unicode characters to ANSI. It allows you to go from Unicode to ANSI using a particular code page. The GETTEXTEX structure contains members (lpDefaultChar and lpUsedDefChar) that are used in the translation from Unicode to ANSI. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextex + EM_GETTEXTEX = WindowMessage.WM_USER + 94, + /// Calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control. + /// + /// Parameters + /// + /// wParam + /// Pointer to a GETTEXTLENGTHEX structure that receives the text length information. + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// The message returns the number of TCHARs in the edit control, depending on the setting of the flags in the GETTEXTLENGTHEX structure. If incompatible flags were set in the flags member, the message returns E_INVALIDARG . + /// This message is a fast and easy way to determine the number of characters in the Unicode version of the rich edit control. However, for a non-Unicode target code page you will potentially be converting to a combination of single-byte and double-byte characters. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextlengthex + EM_GETTEXTLENGTHEX = WindowMessage.WM_USER + 95, + /// Shows or hides one of the scroll bars in the host window of a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Identifies which scroll bar to display: horizontal or vertical. This parameter must be SB_VERT or SB_HORZ. + /// lParam + /// Specifies whether to show the scroll bar or hide it. Specify TRUE to show the scroll bar and FALSE to hide it. + /// + /// Returns + /// + /// This message does not return a value. + /// This method is only valid when the control is in-place active. Calls made while the control is inactive may fail. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-showscrollbar + EM_SHOWSCROLLBAR = WindowMessage.WM_USER + 96, + /// Combines the functionality of the WM_SETTEXT and EM_REPLACESEL messages, and adds the ability to set text using a code page and to use either rich text or plain text. + /// + /// Parameters + /// + /// wParam + /// Pointer to a SETTEXTEX structure that specifies flags and an optional code page to use in translating to Unicode. + /// lParam + /// Pointer to the null-terminated text to insert. This text is an ANSI string, unless the code page is 1200 (Unicode). If lParam starts with a valid RTF ASCII sequence for example, "{\rtf" or "{urtf" the text is read in using the RTF reader. + /// + /// Returns + /// + /// If the operation is setting all of the text and succeeds, the return value is 1. + /// If the operation is setting the selection and succeeds, the return value is the number of bytes or characters copied. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-settextex + EM_SETTEXTEX = WindowMessage.WM_USER + 97, + /// + /// Sets the punctuation characters for a rich edit control. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. + /// + /// + /// Parameters + /// + /// wParam + /// Specifies the punctuation type, which can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// PC_LEADING + /// Leading punctuation characters. + /// + /// + /// PC_FOLLOWING + /// Following punctuation characters. + /// + /// + /// PC_DELIMITER + /// Delimiter. + /// + /// + /// PC_OVERFLOW + /// Not supported. + /// + /// + /// lParam + /// Pointer to a PUNCTUATION structure that contains the punctuation characters. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpunctuation + EM_SETPUNCTUATION = WindowMessage.WM_USER + 100, + /// + /// Gets the current punctuation characters for the rich edit control. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions of Rich Edit. + /// + /// + /// Parameters + /// + /// wParam + /// The punctuation type can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// PC_LEADING + /// Leading punctuation characters + /// + /// + /// PC_FOLLOWING + /// Following punctuation characters + /// + /// + /// PC_DELIMITER + /// Delimiter + /// + /// + /// PC_OVERFLOW + /// Not supported + /// + /// + /// lParam + /// Pointer to a PUNCTUATION structure that receives the punctuation characters. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getpunctuation + EM_GETPUNCTUATION = WindowMessage.WM_USER + 101, + /// + /// Sets the word-wrapping and word-breaking options for a rich edit control. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. + /// + /// + /// Parameters + /// + /// wParam + /// Specifies one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// WBF_WORDWRAP + /// Enables Asian-specific word wrap operations, such as kinsoku in Japanese. + /// + /// + /// WBF_WORDBREAK + /// Enables English word-breaking operations in Japanese and Chinese. Enables Hangeul word-breaking operation. + /// + /// + /// WBF_OVERFLOW + /// Recognizes overflow punctuation. (Not currently supported.) + /// + /// + /// WBF_LEVEL1 + /// Sets the Level 1 punctuation table as the default. + /// + /// + /// WBF_LEVEL2 + /// Sets the Level 2 punctuation table as the default. + /// + /// + /// WBF_CUSTOM + /// Sets the application-defined punctuation table. + /// + /// + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// This message returns the current word-wrapping and word-breaking options. + /// This message must not be sent by the application defined word breaking procedure. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setwordwrapmode + EM_SETWORDWRAPMODE = WindowMessage.WM_USER + 102, + /// + /// Gets the current word wrap and word-break options for the rich edit control. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions of Rich Edit. + /// + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The message returns the current word wrap and word-break options. + /// This message must not be sent by the application-defined, word-break procedure. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getwordwrapmode + EM_GETWORDWRAPMODE = WindowMessage.WM_USER + 103, + /// + /// Sets the Input Method Editor (IME) composition color for a rich edit control. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. + /// + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a COMPCOLOR structure that contains the composition color to be set. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimecolor + EM_SETIMECOLOR = WindowMessage.WM_USER + 104, + /// + /// Retrieves the Input Method Editor (IME) composition color. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions of Rich Edit. + /// + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// A four-element array of COMPCOLOR structures that receives the composition color. + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/Controls/em-getimecolor + EM_GETIMECOLOR = WindowMessage.WM_USER + 105, + /// + /// Sets the Input Method Editor (IME) options. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. + /// + /// + /// Parameters + /// + /// wParam + /// Specifies one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// ECOOP_SET + /// Sets the options to those specified by lParam. + /// + /// + /// ECOOP_OR + /// Combines the specified options with the current options. + /// + /// + /// ECOOP_AND + /// Retains only those current options that are also specified by lParam. + /// + /// + /// ECOOP_XOR + /// Logically exclusive OR the current options with those specified by lParam. + /// + /// + /// lParam + /// Specifies one of more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// IMF_CLOSESTATUSWINDOW + /// Closes the IME status window when the control receives the input focus. + /// + /// + /// IMF_FORCEACTIVE + /// Activates the IME when the control receives the input focus. + /// + /// + /// IMF_FORCEDISABLE + /// Disables the IME when the control receives the input focus. + /// + /// + /// IMF_FORCEENABLE + /// Enables the IME when the control receives the input focus. + /// + /// + /// IMF_FORCEINACTIVE + /// Inactivates the IME when the control receives the input focus. + /// + /// + /// IMF_FORCENONE + /// Disables IME handling. + /// + /// + /// IMF_FORCEREMEMBER + /// Restores the previous IME status when the control receives the input focus. + /// + /// + /// IMF_MULTIPLEEDIT + /// Specifies that the composition string will not be canceled or determined by focus changes. This allows an application to have separate composition strings on each rich edit control. + /// + /// + /// IMF_VERTICAL + /// Note used in Rich Edit 2.0 and later. + /// + /// + /// + /// Returns + /// + /// If the operation succeeds, the return value is a nonzero value. + /// If the operation fails, the return value is zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimeoptions + EM_SETIMEOPTIONS = WindowMessage.WM_USER + 106, + /// + /// Retrieves the current Input Method Editor (IME) options. + /// Note This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions of Rich Edit. + /// + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// This message returns one or more of the IME option flag values described in the EM_SETIMEOPTIONS message. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimeoptions + EM_GETIMEOPTIONS = WindowMessage.WM_USER + 107, + /// + /// This message is not implemented. + ///  + ///  + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-convposition + EM_CONVPOSITION = WindowMessage.WM_USER + 108, + /// Sets options for Input Method Editor (IME) and Asian language support in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Specifies the language options. For a list of possible values, see EM_GETLANGOPTIONS. + /// + /// Returns + /// + /// This message returns a value of 1. + /// + /// The EM_SETLANGOPTIONS message controls the following: + /// + /// + /// Automatic font binding. + /// + /// + /// Automatic keyboard switching. + /// + /// + /// Automatic font size adjustment. + /// + /// + /// Use of user-interface default fonts instead of document default fonts. + /// + /// + /// Notifications to client during IME composition. + /// + /// + /// How IME aborts composition mode. + /// + /// + /// Spell checking, autocorrect, and touch keyboard prediction. + /// + /// + /// This message sets the values of all language option flags. To change a subset of the flags, send the EM_GETLANGOPTIONS message to get the current option flags, change the flags that you need to change, and then send the EM_SETLANGOPTIONS message with the result. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setlangoptions + EM_SETLANGOPTIONS = WindowMessage.WM_USER + 120, + /// Gets a rich edit control's option settings for Input Method Editor (IME) and Asian language support. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns the IME and Asian language settings, which can be zero or more of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// IMF_AUTOFONT + /// If this flag is set, the control automatically changes fonts when the user explicitly changes to a different keyboard layout. It is useful to turn off IMF_AUTOFONT for universal Unicode fonts. This option is turned on by default (1). + /// + /// + /// IMF_AUTOFONTSIZEADJUST + /// If this flag is set, the control scales font-bound font sizes from insertion point size according to script. For example, Asian fonts are slightly larger than Western ones. This option is turned on by default (1). + /// + /// + /// IMF_AUTOKEYBOARD + /// If this flag is set, the control automatically changes the keyboard layout when the user explicitly changes to a different font, or when the user explicitly changes the insertion point to a new location in the text. Will be turned on automatically for bidirectional controls. For all other controls, it is turned off by default. This option is turned off by default (0). + /// + /// + /// IMF_DISABLEAUTOBIDIAUTOKEYBOARD + /// Windows 8: If this flag is set, the control uses language neutral logic for automatic keyboard switching. This option is turned off by default (0). + /// + /// + /// IMF_DUALFONT + /// If this flag is set, the control uses dual-font mode. Used for Asian language support. The control uses an English font for ASCII text and a Asian font for Asian text. This option is turned on by default (1). + /// + /// + /// IMF_IMEALWAYSSENDNOTIFY + /// This flag controls how the rich edit control notifies the client during IME composition: 0: No EN_CHANGE or EN_SELCHANGE notifications during undetermined state. Send notification when the final string comes in. This is the default. 1: Send EN_CHANGE and EN_SELCHANGE events during undetermined state. + /// + /// + /// IMF_IMECANCELCOMPLETE + /// This flag determines how the control uses the composition string of an IME if the user cancels it. If this flag is set, the control discards the composition string. If this flag is not set, the control uses the composition string as the result string. This option is turned off by default (0). + /// + /// + /// IMF_NOIMPLICITLANG + /// Windows 8: If this flag is set, disable stamping keyboard input with the keyboard language and ensuring that non-East Asian language IDss are compatible with the character repertoire. This option is turned off by default (0). + /// + /// + /// IMF_NOKBDLIDFIXUP + /// Windows 8: If this flag is set, the rich edit control disables stamping keyboard language on an empty control. This option is turned off by default (0). + /// + /// + /// IMF_SPELLCHECKING + /// Windows 8: If this flag is set, the rich edit control turns on spell checking. This option is turned off by default (0). + /// + /// + /// IMF_TKBAUTOCORRECTION + /// Windows 8: If this flag is set, enable touch keyboard autocorrect. This option is turned off by default (0). + /// + /// + /// IMF_TKBPREDICTION + /// Windows 10: Ignored. Windows 8: If this flag is set, the rich edit control enables touch keyboard prediction. This option is turned off by default (0). + /// + /// + /// IMF_UIFONTS + /// Use user-interface default fonts. This option is turned off by default (0). + /// + /// + /// The IMF_AUTOFONT flag is set by default. The IMF_AUTOKEYBOARD and IMF_IMECANCELCOMPLETE flags are cleared by default. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getlangoptions + EM_GETLANGOPTIONS = WindowMessage.WM_USER + 121, + /// Retrieves the current Input Method Editor (IME) mode for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The return value is one of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// ICM_NOTOPEN + /// IME is not open. + /// + /// + /// ICM_LEVEL3 + /// True inline mode. + /// + /// + /// ICM_LEVEL2 + /// Level 2. + /// + /// + /// ICM_LEVEL2_5 + /// Level 2.5 + /// + /// + /// ICM_LEVEL2_SUI + /// Special UI. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimecompmode + EM_GETIMECOMPMODE = WindowMessage.WM_USER + 122, + /// Finds Unicode text within a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the parameters of the search operation. This parameter can be one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// FR_DOWN + /// If set, the operation searches from the end of the current selection to the end of the document. If not set, the operation searches from the end of the current selection to the beginning of the document. + /// + /// + /// FR_MATCHALEFHAMZA + /// By default, Arabic and Hebrew alefs with different accents are all matched by the alef character. Set this flag if you want the search to differentiate between alefs with different accents. + /// + /// + /// FR_MATCHCASE + /// If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive. + /// + /// + /// FR_MATCHDIAC + /// By default, Arabic and Hebrew diacritical marks are ignored. Set this flag if you want the search operation to consider diacritical marks. + /// + /// + /// FR_MATCHKASHIDA + /// By default, Arabic and Hebrew kashidas are ignored. Set this flag if you want the search operation to consider kashidas. + /// + /// + /// FR_WHOLEWORD + /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for word fragments that match the search string. + /// + /// + /// lParam + /// A FINDTEXTW structure containing information about the find operation. + /// + /// Returns + /// + /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is not found, the return value is -1. + /// EM_FINDTEXTW uses the FINDTEXTW structure, while EM_FINDTEXTEXW uses the FINDTEXTEXW structure. The difference is that FINDTEXTEXW reports back the range of text that was found. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtextw + EM_FINDTEXTW = WindowMessage.WM_USER + 123, + /// Finds Unicode text within a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies the behavior of the search operation. This parameter can be one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// FR_DOWN + /// Microsoft Rich Edit 2.0 and later: If set, the search is forward from FINDTEXTEX.chrg.cpMin; if not set, the search is backward from FINDTEXTEX.chrg.cpMin. Microsoft Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always forward. + /// + /// + /// FR_MATCHALEFHAMZA + /// If set, the search differentiates between alefs with different accents. If not set, Arabic and Hebrew alefs with different accents are all matched by the alef character. + /// + /// + /// FR_MATCHCASE + /// If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive. + /// + /// + /// FR_MATCHDIAC + /// If set, the search operation considers diacritical marks. If not set, Arabic and Hebrew diacritical marks are ignored. + /// + /// + /// FR_MATCHKASHIDA + /// If set, the search operation considers kashidas. If not set, Arabic and Hebrew kashidas are ignored. + /// + /// + /// FR_WHOLEWORD + /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for word fragments that match the search string. + /// + /// + /// lParam + /// A FINDTEXTEXW structure containing information about the find operation. + /// + /// Returns + /// + /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is not found, the return value is -1. + /// + /// Use this message to find Unicode strings. For ANSI;, use EM_FINDTEXTEX. + /// The cpMin member of FINDTEXTEX.chrg always specifies the starting-point of the search, and cpMax specifies the end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a value of -1 in cpMax extends the search range to the end of the text. + /// If the search operation finds a match, the chrgText member of the FINDTEXTEX structure returns the range of character positions that contains the matching text. + /// EM_FINDTEXTEXW uses the FINDTEXTEXW structure, while EM_FINDTEXTW uses the FINDTEXTW structure. The difference is that EM_FINDTEXTEXW reports the range of text that was found. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtextexw + EM_FINDTEXTEXW = WindowMessage.WM_USER + 124, + /// Invokes the Input Method Editor (IME) reconversion dialog box. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// This message always returns zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-reconversion + EM_RECONVERSION = WindowMessage.WM_USER + 125, + /// Set the Input Method Editor (IME) mode bias for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// IME mode bias value. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// IMF_SMODE_PLAURALCLAUSE + /// Sets the IME mode bias to Name. + /// + /// + /// IMF_SMODE_NONE + /// No bias. + /// + /// + /// lParam + /// This must be the same value as wParam. + /// + /// Returns + /// + /// This message returns the new IME mode bias setting. + /// + /// When the IME generates a list of alternative choices for a set of characters, this message sets the criteria by which some of the choices will appear at the top of the list. + /// To set the Text Services Framework (TSF) mode bias, use EM_SETCTFMODEBIAS. + /// The application should call EM_ISIME before calling this function. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimemodebias + EM_SETIMEMODEBIAS = WindowMessage.WM_USER + 126, + /// Retrieves the Input Method Editor (IME) mode bias for a Microsoft Rich Edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// This message returns the current IME mode bias setting. + /// + /// To get the Text Services Framework mode bias, use EM_GETCTFMODEBIAS. + /// The application should call EM_ISIME before calling this function. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimemodebias + EM_GETIMEMODEBIAS = WindowMessage.WM_USER + 127, + /// The EM_SETBIDIOPTIONS message sets the current state of the bidirectional options in the rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a BIDIOPTIONS structure that indicates how to set the state of the bidirectional options in the rich edit control. + /// + /// Returns + /// + /// This message does not return a value. + /// + /// The rich edit control must be in plain text mode or EM_SETBIDIOPTIONS will not do anything. + /// In plain text controls, EM_SETBIDIOPTIONS automatically determines the paragraph direction and/or alignment based on the context rules. These rules state that the direction and/or alignment is derived from the first strong character in the control. A strong character is one from which text direction can be determined (see Unicode Standard version 2.0). The paragraph direction and/or alignment is applied to the default format. + /// EM_SETBIDIOPTIONS only switches the default paragraph format to RTL (right to left) if it finds an RTL character, + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setbidioptions + EM_SETBIDIOPTIONS = WindowMessage.WM_USER + 200, + /// Indicates the current state of the bidirectional options in the rich edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// A BIDIOPTIONS structure that receives the current state of the bidirectional options in the rich edit control. + /// + /// Returns + /// + /// This message does not return a value. + /// This message sets the values of the wMask and wEffects members to the value of the current state of the bidirectional options in the rich edit control. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getbidioptions + EM_GETBIDIOPTIONS = WindowMessage.WM_USER + 201, + /// Sets the current state of the typography options of a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies one or both of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// TO_ADVANCEDTYPOGRAPHY + /// Advanced line breaking and line formatting is turned on. + /// + /// + /// TO_SIMPLELINEBREAK + /// Faster line breaking for simple text (requires TO_ADVANCEDTYPOGRAPHY). + /// + /// + /// lParam + /// A mask consisting of one or more of the flags in wParam. Only the flags that are set in this mask will be set or cleared. This allows a single flag to be set or cleared without reading the current flag states. + /// + /// Returns + /// + /// Returns TRUE if wParam is valid, otherwise FALSE. + /// Advanced line breaking is turned on automatically by the rich edit control when needed, such as for handling complex scripts like Arabic and Hebrew, and for mathematics. It s also needed for justified paragraphs, hyphenation, and other typographic features. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-settypographyoptions + EM_SETTYPOGRAPHYOPTIONS = WindowMessage.WM_USER + 202, + /// Returns the current state of the typography options of a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns the current typography options. For a list of options, see EM_SETTYPOGRAPHYOPTIONS. + /// You can turn on advanced line breaking by sending the EM_SETTYPOGRAPHYOPTIONS message. Advanced and normal line breaking may also be turned on automatically by the rich edit control if it is needed for certain languages. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettypographyoptions + EM_GETTYPOGRAPHYOPTIONS = WindowMessage.WM_USER + 203, + /// Sets the current edit style flags for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Specifies one or more edit style flags. For a list of possible values, see EM_GETEDITSTYLE. + /// lParam + /// A mask consisting of one or more of the wParam values. Only the values specified in this mask will be set or cleared. This allows a single flag to be set or cleared without reading the current flag states. + /// + /// Returns + /// + /// The return value is the state of the edit style flags after the rich edit control has attempted to implement your edit style changes. The edit style flags are a set of flags that indicate the current edit style. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-seteditstyle + EM_SETEDITSTYLE = WindowMessage.WM_USER + 204, + /// Retrieves the current edit style flags. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns the current edit style flags, which can include one or more of the following values: + /// + /// + /// Return code + /// Description + /// + /// + /// SES_BEEPONMAXTEXT + /// Rich Edit will call the system beeper if the user attempts to enter more than the maximum characters. + /// + /// + /// SES_BIDI + /// Turns on bidirectional processing. This is automatically turned on by Rich Edit if any of the following window styles are active: WS_EX_RIGHT, WS_EX_RTLREADING, WS_EX_LEFTSCROLLBAR. However, this setting is useful for handling these window styles when using a custom implementation of ITextHost (default: 0). + /// + /// + /// SES_CTFALLOWEMBED + /// Windows XP with SP1: Allow embedded objects to be inserted using TSF (default: 0). + /// + /// + /// SES_CTFALLOWPROOFING + /// Windows XP with SP1: Allows TSF proofing tips (default: 0). + /// + /// + /// SES_CTFALLOWSMARTTAG + /// Windows XP with SP1: Allows TSF SmartTag tips (default: 0). + /// + /// + /// SES_CTFNOLOCK + /// Windows 8: Do not allow the TSF lock read/write access. This pauses TSF input. + /// + /// + /// SES_DEFAULTLATINLIGA + /// Windows 8: Fonts with an fi ligature are displayed with default OpenType features resulting in improved typography (default: 0). + /// + /// + /// SES_DRAFTMODE + /// Windows XP with SP1: Use draft mode fonts to display text. Draft mode is an accessibility option where the control displays the text with a single font; the font is determined by the system setting for the font used in message boxes. For example, accessible users may read text easier if it is uniform, rather than a mix of fonts and styles (default: 0). + /// + /// + /// SES_EMULATE10 + /// Windows 8: Emulate RichEdit 1.0 behavior. + /// + /// + /// SES_EMULATESYSEDIT + /// When this bit is on, rich edit attempts to emulate the system edit control (default: 0). + /// + /// + /// SES_EXTENDBACKCOLOR + /// Extends the background color all the way to the edges of the client rectangle (default: 0). + /// + /// + /// SES_HIDEGRIDLINES + /// Windows XP with SP1: If the width of table gridlines is zero, gridlines are not displayed. This is equivalent to the hide gridlines feature in Word's table menu (default: 0). + /// + /// + /// SES_HYPERLINKTOOLTIPS + /// Windows 8: When the cursor is over a link, display a tooltip with the target link address (default: 0). + /// + /// + /// SES_LOGICALCARET + /// Windows 8: Provide logical caret information instead of a caret bitmap as described in ITextHost::TxSetCaretPos (default: 0). + /// + /// + /// SES_LOWERCASE + /// Converts all input characters to lowercase (default: 0). + /// + /// + /// SES_MAPCPS + /// Obsolete. Do not use. + /// + /// + /// SES_MULTISELECT + /// Windows 8: Enable multiselection with individual mouse selections made while the Ctrl key is pressed (default: 0). + /// + /// + /// SES_NOEALINEHEIGHTADJUST + /// Windows 8: Do not adjust line height for East Asian text (default: 0 which adjusts the line height by 15%). + /// + /// + /// SES_NOFOCUSLINKNOTIFY + /// Sends EN_LINK notification from links that do not have focus. + /// + /// + /// SES_NOIME + /// Disallows IMEs for this instance of the rich edit control (default: 0). + /// + /// + /// SES_NOINPUTSEQUENCECHK + /// When this bit is on, rich edit does not verify the sequence of typed text. Some languages (such as Thai and Vietnamese) require verifying the input sequence order before submitting it to the backing store (default: 0). + /// + /// + /// SES_SCROLLONKILLFOCUS + /// When KillFocus occurs, scroll to the beginning of the text (character position equal to 0) (default: 0). + /// + /// + /// SES_SMARTDRAGDROP + /// Windows 8: Add or delete a space according to the context when dropping text (default: 0). + /// + /// + /// SES_USECRLF + /// Obsolete. Do not use. + /// + /// + /// SES_WORDDRAGDROP + /// Windows 8: If word select is active, ensure that the drop location is at a word boundary (default: 0). + /// + /// + /// SES_UPPERCASE + /// Converts all input characters to uppercase (default: 0). + /// + /// + /// SES_USEAIMM + /// Uses the Active IMM input method component that ships with Internet Explorer 4.0 or later (default: 0). + /// + /// + /// SES_USEATFONT + /// Windows XP with SP1: Uses an @ font, which is designed for vertical text; this is used with the ES_VERTICAL window style. The name of an @ font begins with the @ symbol, for example, "@Batang" (default: 0, but is automatically turned on for vertical text layout). + /// + /// + /// SES_USECTF + /// Windows XP with SP1: Turns on TSF support. (default: 0) + /// + /// + /// SES_XLTCRCRLFTOCR + /// Turns on translation of CRCRLFs to CRs. When this bit is on and a file is read in, all instances of CRCRLF will be converted to hard CRs internally. This will affect the text wrapping. Note that if such a file is saved as plain text, the CRs will be replaced by CRLFs. This is the .txt standard for plain text (default: 0, which deletes CRCRLFs on input). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-geteditstyle + EM_GETEDITSTYLE = WindowMessage.WM_USER + 205, + /// Undocumented + EM_OUTLINE = WindowMessage.WM_USER + 220, + /// Obtains the current scroll position of the edit control. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a POINT structure. After calling EM_GETSCROLLPOS, this parameters contains a point in the virtual text space of the document, expressed in pixels. This point will be the point that is currently located in the upper-left corner of the edit control window. + /// + /// Returns + /// + /// This message always returns 1. + /// The values returned in the POINT structure are 16-bit values (even in the 32-bit wide fields). + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getscrollpos + EM_GETSCROLLPOS = WindowMessage.WM_USER + 221, + /// Scrolls the contents of a rich edit control to the specified point. + /// + /// Parameters + /// + /// wParam + /// This parameter is not used; it must be zero. + /// lParam + /// Pointer to a POINT structure which specifies a point in the virtual text space of the document, expressed in pixels. The document will be scrolled until this point is located in the upper-left corner of the edit control window. If you want to change the view such that the upper left corner of the view is two lines down and one character in from the left edge. You would pass a point of (7, 22). + /// The rich edit control checks the x and y coordinates and adjusts them if necessary, so that a complete line is displayed at the top. It also ensures that the text is never completely scrolled off the view rectangle. + /// + /// Returns + /// + /// This message always returns 1. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setscrollpos + EM_SETSCROLLPOS = WindowMessage.WM_USER + 222, + /// Sets the font size for the selected text in a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Change in point size of the selected text. The result will be rounded according to values shown in the following table. This parameter should be in the range of -1637 to 1638. The resulting font size will be within the range of 1 to 1638. + /// lParam + /// This parameter is not used; it must be zero. + /// + /// Returns + /// + /// If no error occurred, the return value is TRUE. + /// If an error occurred, the return value is FALSE. + /// + /// You can easily get the font size by sending the EM_GETCHARFORMAT message. + /// Rich Edit first adds wParam to the current font size and then uses the resulting size and the following table to determine the rounding value. + /// + /// + /// Band + /// Rounding value + /// + /// + /// <=12 + /// 1 + /// + /// + /// 28 + /// 2 + /// + /// + /// 36 + /// 0 + /// + /// + /// 48 + /// 0 + /// + /// + /// 72 + /// 0 + /// + /// + /// 80 + /// 0 + /// + /// + /// > 80 + /// 10 + /// + /// + /// If the resulting font size is not evenly divisible by the rounding value, the font size is then rounded to a number evenly divisible by the rounding value. So if the font size is less than or equal to 12, the rounding value will be 1. Similarly, if the font size is less than or equal to 28, the rounding value is 2. For values greater than 28, font sizes are rounded to the next band. So, the font size jumps to 36, 48, 72, 80. After 80, all rounding is done in increments of ten points. + /// The font size is rounded up or down depending on the sign of wParam. If wParam is positive, the rounding is always up. Otherwise, rounding is always down. So, if the current font size is 10 and wParam is 3, the resulting font size would be 14 (10 + 3 = 13, which is not divisible by 2, so the size rounds up to 14). Conversely, if the current font size is 14 and wParam is -3, the resulting font size would be 10 (14 - 3 = 11, which is not divisible by 2, so the size rounds down to 10). + /// The change is applied to each part of the selection. So, if some of the text is 10pt and some 20pt, after a call with wParam set to 1, the font sizes become 11pt and 22pt, respectively. + /// Additional examples are shown in the following table. + /// + /// + /// Original font size + /// wParam + /// Resulting font size + /// + /// + /// 7 + /// 1 + /// 8 + /// + /// + /// 7 + /// 3 + /// 10 + /// + /// + /// 10 + /// 3 + /// 14 + /// + /// + /// 14 + /// -3 + /// 10 + /// + /// + /// 28 + /// 1 + /// 36 + /// + /// + /// 28 + /// 3 + /// 36 + /// + /// + /// 80 + /// 1 + /// 90 + /// + /// + /// 80 + /// -1 + /// 72 + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setfontsize + EM_SETFONTSIZE = WindowMessage.WM_USER + 223, + /// Gets the current zoom ratio for a multiline edit control or a rich edit control. The zoom ration is always between 1/64 and 64. + /// + /// Parameters + /// + /// wParam + /// Receives the numerator of the zoom ratio. + /// lParam + /// Receives the denominator of the zoom ratio. + /// + /// Returns + /// + /// The message returns TRUE if message is processed, which it will be if both wParam and lParam are not NULL. + /// Edit: Supported in Windows 10 1809 and later. The edit control needs to have the ES_EX_ZOOMABLE extended style set, for this message to have an effect, see Edit Control Extended Styles. For information about the edit control, see Edit Controls. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getzoom + EM_GETZOOM = WindowMessage.WM_USER + 224, + /// Sets the zoom ratio for a multiline edit control or a rich edit control. The ratio must be a value between 1/64 and 64. The edit control needs to have the ES_EX_ZOOMABLE extended style set, for this message to have an effect, see Edit Control Extended Styles. + /// + /// Parameters + /// + /// wParam + /// Numerator of the zoom ratio. + /// lParam + /// Denominator of the zoom ratio. These parameters can have the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// Both 0 + /// Turns off zooming by using the EM_SETZOOM message (zooming may still occur using TxGetExtent). + /// + /// + /// 1/64 < (wParam / lParam) < 64 + /// Zooms display by the zoom ratio numerator/denominator + /// + /// + /// + /// Returns + /// + /// If the new zoom setting is accepted, the return value is TRUE. + /// If the new zoom setting is not accepted, the return value is FALSE. + /// Edit: Supported in Windows 10 1809 and later. The edit control needs to have the ES_EX_ZOOMABLE extended style set, for this message to have an effect, see Edit Control Extended Styles. For information about the edit control, see Edit Controls. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setzoom + EM_SETZOOM = WindowMessage.WM_USER + 225, + /// Undocumented + EM_GETVIEWKIND = WindowMessage.WM_USER + 226, + /// Undocumented + EM_SETVIEWKIND = WindowMessage.WM_USER + 227, + /// Undocumented + EM_GETPAGE = WindowMessage.WM_USER + 228, + /// Undocumented + EM_SETPAGE = WindowMessage.WM_USER + 229, + /// Retrieves information about hyphenation for a Microsoft Rich Edit control. + /// + /// Parameters + /// + /// wParam + /// The HYPHENATEINFO structure. + /// lParam + /// Not used; must be zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gethyphenateinfo + EM_GETHYPHENATEINFO = WindowMessage.WM_USER + 230, + /// Sets the way a rich edit control does hyphenation. + /// + /// Parameters + /// + /// wParam + /// Pointer to a HYPHENATEINFO structure. + /// lParam + /// Not used, must be zero. + /// NoteTo enable hyphenation, the client must call EM_SETTYPOGRAPHYOPTIONS, specifying TO_ADVANCEDTYPOGRAPHY. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-sethyphenateinfo + EM_SETHYPHENATEINFO = WindowMessage.WM_USER + 231, + /// + /// [EM_GETPAGEROTATE is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.] + /// Gets the text layout for a Microsoft Rich Edit control. + /// + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Gets the current text layout. For a list of possible text layout values, see EM_SETPAGEROTATE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getpagerotate + EM_GETPAGEROTATE = WindowMessage.WM_USER + 235, + /// + /// [EM_SETPAGEROTATE is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.] + /// Sets the text layout for a rich edit control. + /// + /// + /// Parameters + /// + /// wParam + /// Text layout value. This can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// EPR_0 + /// Text flows from left to right and from top to bottom. + /// + /// + /// EPR_90 + /// Text flows from bottom to top and from left to right. + /// + /// + /// EPR_180 + /// Text flows from right to left and from bottom to top. + /// + /// + /// EPR_270 + /// Text flows from top to bottom and from right to left. + /// + /// + /// EPR_SE + /// Windows 8: Text flows top to bottom and left to right (Mongolian text layout). + /// + /// + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Return value is the new text layout value. + /// This message sets the text layout for the entire document. However, embedded contents are not rotated and must be rotated separately by the application. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpagerotate + EM_SETPAGEROTATE = WindowMessage.WM_USER + 236, + /// Gets the Text Services Framework mode bias values for a Microsoft Rich Edit control. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The current Text Services Framework mode bias value. + /// To get the IME mode bias, call EM_GETIMEMODEBIAS. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getctfmodebias + EM_GETCTFMODEBIAS = WindowMessage.WM_USER + 237, + /// Sets the Text Services Framework (TSF) mode bias for a rich edit control. + /// + /// Parameters + /// + /// wParam + /// Mode bias value. This can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// CTFMODEBIAS_DEFAULT + /// There is no mode bias. + /// + /// + /// CTFMODEBIAS_FILENAME + /// The bias is to a filename. + /// + /// + /// CTFMODEBIAS_NAME + /// The bias is to a name. + /// + /// + /// CTFMODEBIAS_READING + /// The bias is to the reading. + /// + /// + /// CTFMODEBIAS_DATETIME + /// The bias is to a date or time. + /// + /// + /// CTFMODEBIAS_CONVERSATION + /// The bias is to a conversation. + /// + /// + /// CTFMODEBIAS_NUMERIC + /// The bias is to a number. + /// + /// + /// CTFMODEBIAS_HIRAGANA + /// The bias is to hiragana strings. + /// + /// + /// CTFMODEBIAS_KATAKANA + /// The bias is to katakana strings. + /// + /// + /// CTFMODEBIAS_HANGUL + /// The bias is to Hangul characters. + /// + /// + /// CTFMODEBIAS_HALFWIDTHKATAKANA + /// The bias is to half-width katakana strings. + /// + /// + /// CTFMODEBIAS_FULLWIDTHALPHANUMERIC + /// The bias is to full-width alphanumeric characters. + /// + /// + /// CTFMODEBIAS_HALFWIDTHALPHANUMERIC + /// The bias is to half-width alphanumeric characters. + /// + /// + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If successful, the return value is the new TSF mode bias value. If unsuccessful, the return value is the old TSF mode bias value. + /// + /// When a Microsoft Rich Edit application uses TSF, it can select the TSF mode bias. This message sets the criteria by which an alternative choice appears at the top of the list for selection. + /// To set the mode bias for the Input Method Editor (IME), use EM_SETIMEMODEBIAS. + /// + // https://learn.microsoft.com/en-us/windows/win32/Controls/em-setctfmodebias + EM_SETCTFMODEBIAS = WindowMessage.WM_USER + 238, + /// Determines if the Text Services Framework (TSF) keyboard is open or closed. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If the TSF keyboard is open, the return value is TRUE. Otherwise, it is FALSE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getctfopenstatus + EM_GETCTFOPENSTATUS = WindowMessage.WM_USER + 240, + /// Opens or closes the Text Services Framework (TSF) keyboard. + /// + /// Parameters + /// + /// wParam + /// To turn on the TSF keyboard, use TRUE. To turn off the TSF keyboard, use FALSE. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// If successful, this message returns TRUE. If unsuccessful, this message returns FALSE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setctfopenstatus + EM_SETCTFOPENSTATUS = WindowMessage.WM_USER + 241, + /// Retrieves the Input Method Editor (IME) composition text. + /// + /// Parameters + /// + /// wParam + /// The IMECOMPTEXT structure. + /// lParam + /// The buffer that receives the composition text. The size of this buffer is contained in the cb member of the wParam structure. + /// + /// Returns + /// + /// If successful, the return value is the number of Unicode characters copied to the buffer. Otherwise, it is zero. + /// + /// This message only takes Unicode strings. + /// Security Warning: Be sure to have a buffer sufficient for the size of the input. Failure to do so could cause problems for your application. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimecomptext + EM_GETIMECOMPTEXT = WindowMessage.WM_USER + 242, + /// Determine with a rich edit control's current input locale is an East Asian locale. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns TRUE if it is an East Asian locale. Otherwise, it returns FALSE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-isime + EM_ISIME = WindowMessage.WM_USER + 243, + /// Retrieves the property and capabilities of the Input Method Editor (IME) associated with the current input locale. + /// + /// Parameters + /// + /// wParam + /// Specifies the type of property information to retrieve. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// IGP_PROPERTY + /// Property information. + /// + /// + /// IGP_CONVERSION + /// Conversion capabilities. + /// + /// + /// IGP_SENTENCE + /// Sentence mode capabilities. + /// + /// + /// IGP_UI + /// User interface capabilities. + /// + /// + /// IGP_SETCOMPSTR + /// Composition string capabilities. + /// + /// + /// IGP_SELECT + /// Selection inheritance capabilities. + /// + /// + /// IGP_GETIMEVERSION + /// Retrieves the system version number for which the specified IME was created. + /// + /// + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns the property or capability value, depending on the value of the lParam parameter. For more information, see the Remarks. + /// + /// If wParam is IGP_PROPERTY, it returns one or more of the following values. + /// + /// + /// Requirement + /// Value + /// + /// + /// IME_PROP_AT_CARET + /// If set, conversion window is at the caret position. If clear, the window is near caret position. + /// + /// + /// IME_PROP_SPECIAL_UI + /// If set, IME has a nonstandard user interface. The application should not draw in the IME window. + /// + /// + /// IME_PROP_CANDLIST_START_FROM_1 + /// If set, strings in the candidate list are numbered starting at 1. If clear, strings start at zero. + /// + /// + /// IME_PROP_UNICODE + /// If set, the IME is viewed as a UnicodeIME. The system and the IME will communicate through the UnicodeIME interface. If clear, IME will use the ANSI interface to communicate with the system. + /// + /// + /// IME_PROP_COMPLETE_ON_UNSELECT + /// If set, conversion window is at the caret position. If clear, the window is near caret position. + /// + /// + /// IME_PROP_ACCEPT_WIDE_VKEY + /// If set, the IME processes the injected Unicode that came from the SendInput function by using VK_PACKET. If clear, the IME might not process the injected Unicode, and the injected Unicode might be sent to the application directly. + /// + /// + /// If wParam is IGP_UI, it returns one or more of the following values. + /// + /// + /// Requirement + /// Value + /// + /// + /// UI_CAP_2700 + /// Supports text escapement values of 0 or 2700. For more information, see lfEscapement. + /// + /// + /// UI_CAP_ROT90 + /// Supports text escapement values of 0, 900, 1800, or 2700. For more information, see lfEscapement. + /// + /// + /// UI_CAP_ROTANY + /// Supports any text escapement value. For more information, see lfEscapement. + /// + /// + /// If wParam is IGP_SETCOMPSTR, it returns one or more of the following values. + /// + /// + /// Requirement + /// Value + /// + /// + /// SCS_CAP_COMPSTR + /// Can create the composition string by calling the ImmSetCompositionString function with the SCS_SETSTR value. + /// + /// + /// SCS_CAP_MAKEREAD + /// Can create the reading string from corresponding composition string when using the ImmSetCompositionString function with SCS_SETSTR and without setting lpRead. + /// + /// + /// SCS_CAP_SETRECONVERTSTRING + /// This IME can support reconversion. Use ImmSetCompositionString to do the reconversion. + /// + /// + /// If wParam is IGP_SELECT, it returns one or more of the following values. + /// + /// + /// Requirement + /// Value + /// + /// + /// SELECT_CAP_CONVMODE + /// Inherits conversion mode when a new IME is selected. + /// + /// + /// SELECT_CAP_SENTENCE + /// Inherits sentence mode when a new IME is selected. + /// + /// + /// If wParam is IGP_GETIMEVERSION, it returns one or more of the following values. + /// + /// + /// Requirement + /// Value + /// + /// + /// IMEVER_0310 + /// The IME was created for Windows 3.1. + /// + /// + /// IMEVER_0400 + /// The IME was created for Windows 95 or later + /// + /// + /// This message is similar to ImmGetProperty, except that it uses the current input locale. The application should call EM_ISIME before calling this function. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimeproperty + EM_GETIMEPROPERTY = WindowMessage.WM_USER + 244, + /// Undocumented + EM_GETQUERYRTFOBJ = WindowMessage.WM_USER + 269, + /// Undocumented + EM_SETQUERYRTFOBJ = WindowMessage.WM_USER + 270, + /// Gets a pointer to the application-defined AutoCorrectProc function. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns a pointer to the application-defined AutoCorrectProc function. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getautocorrectproc + EM_GETAUTOCORRECTPROC = WindowMessage.WM_USER + 233, + /// Defines the current autocorrect callback procedure. + /// + /// Parameters + /// + /// wParam + /// The AutoCorrectProc callback function. + /// lParam + /// Not used; must be zero + /// + /// Returns + /// + /// If the operation succeeds, the return value is zero. If the operation fails, the return value is a nonzero value. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setautocorrectproc + EM_SETAUTOCORRECTPROC = WindowMessage.WM_USER + 234, + /// Calls the autocorrect callback function that is stored by the EM_SETAUTOCORRECTPROC message, provided that the text preceding the insertion point is a candidate for autocorrection. + /// + /// Parameters + /// + /// wParam + /// A character of type WCHAR. If this character is a tab (U+0009), and the character preceding the insertion point isn t a tab, then the character preceding the insertion point is treated as part of the autocorrect candidate string instead of as a string delimiter; otherwise, wParam has no effect. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The return value is zero if the message succeeds, or nonzero if an error occurs. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-callautocorrectproc + EM_CALLAUTOCORRECTPROC = WindowMessage.WM_USER + 255, + /// Retrieves the table parameters for a table row and the cell parameters for the specified number of cells. + /// + /// Parameters + /// + /// wParam + /// A pointer to a TABLEROWPARMS structure. + /// lParam + /// A pointer to a TABLECELLPARMS structure. + /// + /// Returns + /// + /// Returns S_OK if successful, or one of the following error codes. + /// + /// + /// Return code + /// Description + /// + /// + /// E_FAIL + /// Changes cannot be made. This can occur if the control is a plain-text or single-line control, or if the insertion point is inside a math object. It also occurs if tables are disabled if the EM_SETEDITSTYLEEX message sets the SES_EX_NOTABLE value. + /// + /// + /// E_INVALIDARG + /// The wParam or lParam is NULL or points to an invalid structure. The cbRow member of the TABLEROWPARMS structure must equal sizeof(TABLEROWPARMS) or sizeof(TABLEROWPARMS) 2*sizeof(long). The latter value is the size of the RichEdit 4.1 TABLEROWPARMS structure. The cbCell member of the TABLEROWPARMS structure must equal sizeof(TABLECELLPARMS). The query character position must be at a table row delimiter. + /// + /// + /// E_OUTOFMEMORY + /// Insufficient memory is available. + /// + /// + /// + /// This message gets the table parameters for the row at the character position specified by the cpStartRow member of the TABLEROWPARMS structure, and the number of cells specified by the cCells member of the TABLECELLPARMS structure. + /// The character position specified by the cpStartRow member of the TABLEROWPARMS structure should be at the start of the table row, or at the end delimiter of the table row. If cpStartRow is set to 1, the character position is given by the current selection. In this case, position the selection at the end of the row (between the cell mark and the end delimiter of the table row), or select the row. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettableparms + EM_GETTABLEPARMS = WindowMessage.WM_USER + 265, + /// Sets the current extended edit style flags. + /// + /// Parameters + /// + /// wParam + /// Specifies one or more extended edit style flags. For a list of possible values, see EM_GETEDITSTYLEEX. + /// lParam + /// A mask consisting of one or more of the wParam values. Only the values specified in this mask will be set or cleared. This allows a single flag to be set or cleared without reading the current flag states. + /// + /// Returns + /// + /// The return value is the state of the extended edit style flags after rich edit has attempted to implement your edit style changes. The edit style flags are a set of flags that indicate the current edit style. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-seteditstyleex + EM_SETEDITSTYLEEX = WindowMessage.WM_USER + 275, + /// Retrieves the current extended edit style flags. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns the extended edit style flags, which can include one or more of the following values. + /// + /// + /// Return code + /// Description + /// + /// + /// SES_EX_HANDLEFRIENDLYURL + /// Display friendly name links with the same text color and underlining as automatic links, provided that temporary formatting isn t used or uses text autocolor (default: 0). + /// + /// + /// SES_EX_MULTITOUCH + /// Enable touch support in Rich Edit. This includes selection, caret placement, and context-menu invocation. When this flag is not set, touch is emulated by mouse commands, which do not take touch-mode specifics into account (default: 0). + /// + /// + /// SES_EX_NOACETATESELECTION + /// Display selected text using classic Windows selection text and background colors instead of background acetate color (default: 0). + /// + /// + /// SES_EX_NOMATH + /// Disable insertion of math zones (default: 1). To enable math editing and display, send the EM_SETEDITSTYLEEX message with wParam set to 0, and lParam set to SES_EX_NOMATH. + /// + /// + /// SES_EX_NOTABLE + /// Disable insertion of tables. The EM_INSERTTABLE message returns E_FAIL and RTF tables are skipped (default: 0). + /// + /// + /// SES_EX_USESINGLELINE + /// Enable a multiline control to act like a single-line control with the ability to scroll vertically when the single-line height is greater than the window height (default: 0). + /// + /// + /// SES_HIDETEMPFORMAT + /// Hide temporary formatting that is created when ITextFont.Reset is called with tomApplyTmp. For example, such formatting is used by spell checkers to display a squiggly underline under possibly misspelled words. + /// + /// + /// SES_EX_USEMOUSEWPARAM + /// Use wParam when handling the WM_MOUSEMOVE message and do not call GetAsyncKeyState. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-geteditstyleex + EM_GETEDITSTYLEEX = WindowMessage.WM_USER + 276, + /// Gets the story type. + /// + /// Parameters + /// + /// wParam + /// The story index. + /// lParam + /// Reserved; must be 0. + /// + /// Returns + /// + /// Returns the story type, which can be a client-defined custom value, or one of the following values: + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getstorytype + EM_GETSTORYTYPE = WindowMessage.WM_USER + 290, + /// Sets the story type. + /// + /// Parameters + /// + /// wParam + /// The story index. + /// lParam + /// The new story type. For a list of story types, see EM_GETSTORYTYPE. + /// + /// Returns + /// + /// The story type that was set. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setstorytype + EM_SETSTORYTYPE = WindowMessage.WM_USER + 291, + /// Retrieves the current ellipsis mode. When enabled, an ellipsis ( ) is displayed for text that doesn t fit in the display window. The ellipsis is only used when the control is not active. When active, scroll bars are used to reveal text that doesn t fit into the display window. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Pointer to a DWORD which receives one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// ELLIPSIS_NONE + /// No ellipsis is used. + /// + /// + /// ELLIPSIS_END + /// Ellipsis at the end (forced break). + /// + /// + /// ELLIPSIS_WORD + /// Ellipsis at the end (word break). + /// + /// + /// + /// Returns + /// + /// If wparam is 0 and lparam is not NULL, the return value equals TRUE; otherwise, the return value equals FALSE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getellipsismode + EM_GETELLIPSISMODE = WindowMessage.WM_USER + 305, + /// This message sets the current ellipsis mode. When enabled, an ellipsis ( ) is displayed for text that doesn t fit in the display window. The ellipsis is only used when the control isn t active. When active, scroll bars are used to reveal text that doesn t fit into the display window. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// A DWORD which receives one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// ELLIPSIS_NONE + /// No ellipsis is used. + /// + /// + /// ELLIPSIS_END + /// Ellipsis at the end (forced break). + /// + /// + /// ELLIPSIS_WORD + /// Ellipsis at the end (word break). + /// + /// + /// The bits for these values all fit in the ELLIPSIS_MASK. + /// + /// Returns + /// + /// If wparam is 0 and lparam is one of the values in the table above, the return value equals TRUE; otherwise, the return value equals FALSE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setellipsismode + EM_SETELLIPSISMODE = WindowMessage.WM_USER + 306, + /// Changes the parameters of rows in a table. + /// + /// Parameters + /// + /// wParam + /// A pointer to a TABLEROWPARMS structure. + /// lParam + /// A pointer to a TABLECELLPARMS structure. + /// + /// Returns + /// + /// Returns S_OK if successful, or one of the following error codes. + /// + /// + /// Return code + /// Description + /// + /// + /// E_FAIL + /// Changes cannot be made. This can occur if the control is a plain-text or single-line control, or if the insertion point is inside a math object. It also occurs if tables are disabled, or if the EM_SETEDITSTYLEEX message sets the SES_EX_NOTABLE value. + /// + /// + /// E_INVALIDARG + /// The wParam or lParam is NULL or points to an invalid structure. The cCell member of the TABLEROWPARMS structure must be at least 1 and not more than 63. The cbRow member must equal sizeof(TABLEROWPARMS) or sizeof(TABLEROWPARMS) 2*sizeof(long). The latter value is the size of the RichEdit 4.1 TABLEROWPARMS structure. The cbCell member of TABLEROWPARMS must equal sizeof(TABLECELLPARMS). The insertion point must be at the start of a table or inside a table row, and the number of cells can only change by one. + /// + /// + /// E_OUTOFMEMORY + /// Insufficient memory is available. + /// + /// + /// This message changes the parameters of the number of rows specified by the cRow member of the TABLEROWPARMS structure, if the table has that many consecutive rows. If cRow is less than 0, the message iterates until the end of the table. If the new cell count differs from the current cell count by +1 or 1, it inserts or deletes the cell at the index specified by the iCell member of TABLEROWPARMS. The starting table row is identified by a character position. This position is specified by cpStartRow members with values that are greater than or equal to zero. The position should be inside the table row, but not inside a nested table, unless you want to change that table s parameters. If the cpStartRow member is 1, the character position is given by the current selection. For this, position the selection anywhere inside the table row, or select the row with the active end of the selection at the end of the table row. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-settableparms + EM_SETTABLEPARMS = WindowMessage.WM_USER + 307, + /// Retrieves the touch options that are associated with a rich edit control. + /// + /// Parameters + /// + /// wParam + /// The touch options to retrieve. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// RTO_SHOWHANDLES + /// Retrieves whether the touch grippers are visible. + /// + /// + /// RTO_DISABLEHANDLES + /// Retrieving this flag is not implemented. + /// + /// + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// Returns the value of the option specified by the wParam parameter. It is nonzero if wParam is RTO_SHOWHANDLES and the touch grippers are visible; zero, otherwise. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettouchoptions + EM_GETTOUCHOPTIONS = WindowMessage.WM_USER + 310, + /// Sets the touch options associated with a rich edit control. + /// + /// Parameters + /// + /// wParam + /// The touch option to set. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// RTO_SHOWHANDLES + /// Show or hide the touch gripper handles, depending on the value of lParam. + /// + /// + /// RTO_DISABLEHANDLES + /// Enable or disable the touch gripper handles, depending on the value of lParam. When handles are disabled, they are hidden if they are visible and remain hidden until an EM_SETTOUCHOPTIONS message changes their status. + /// + /// + /// lParam + /// Set to TRUE to show/enable the touch selection handles, or FALSE to hide/disable the touch selection handles. + /// + /// Returns + /// + /// This message returns zero. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-settouchoptions + EM_SETTOUCHOPTIONS = WindowMessage.WM_USER + 311, + /// Replaces the selection with a blob that displays an image. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// A pointer to a RICHEDIT_IMAGE_PARAMETERS structure that contains the image blob. + /// + /// Returns + /// + /// Returns S_OK if successful, or one of the following error codes. + /// + /// + /// Return code + /// Description + /// + /// + /// E_FAIL + /// Cannot insert the image. + /// + /// + /// E_INVALIDARG + /// The lParam parameter is NULL or points to an invalid image. + /// + /// + /// E_OUTOFMEMORY + /// Insufficient memory is available. + /// + /// + /// If the selection is an insertion point, the image blob is inserted at the insertion point. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-insertimage + EM_INSERTIMAGE = WindowMessage.WM_USER + 314, + /// Sets the name of a rich edit control for UI Automation (UIA). + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// A pointer to the null-terminated name string. + /// + /// Returns + /// + /// TRUE if the name for UIA is successfully set, otherwise FALSE. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setuianame + EM_SETUIANAME = WindowMessage.WM_USER + 320, + /// Retrieves the current ellipsis state. + /// + /// Parameters + /// + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// + /// Returns + /// + /// The return value is TRUE if an ellipsis is being displayed and FALSE otherwise. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getellipsisstate + EM_GETELLIPSISSTATE = WindowMessage.WM_USER + 322, + } + + /// Notification codes sent by a rich edit control to its parent window. These are in addition to the standard notification codes. + // https://learn.microsoft.com/en-us/windows/win32/controls/bumper-rich-edit-control-reference-notifications + [PInvokeData("richedit.h")] + public enum RichEditNotification + { + EN_MSGFILTER = 0x0700, + EN_REQUESTRESIZE = 0x0701, + EN_SELCHANGE = 0x0702, + EN_DROPFILES = 0x0703, + EN_PROTECTED = 0x0704, + EN_CORRECTTEXT = 0x0705, + EN_STOPNOUNDO = 0x0706, + EN_IMECHANGE = 0x0707, + EN_SAVECLIPBOARD = 0x0708, + EN_OLEOPFAILED = 0x0709, + EN_OBJECTPOSITIONS = 0x070a, + EN_LINK = 0x070b, + EN_DRAGDROPDONE = 0x070c, + EN_PARAGRAPHEXPANDED = 0x070d, + EN_PAGECHANGE = 0x070e, + EN_LOWFIRTF = 0x070f, + EN_ALIGNLTR = 0x0710, + EN_ALIGNRTL = 0x0711, + EN_CLIPFORMAT = 0x0712, + EN_STARTCOMPOSITION = 0x0713, + EN_ENDCOMPOSITION = 0x0714, + } + /// Styles for the rich edit control. [PInvokeData("Winuser.h", MSDNShortId = "edit_control_constants")] [Flags] @@ -1343,6 +4495,17 @@ public static partial class MsftEdit [return: MarshalAs(UnmanagedType.Bool)] public static extern bool REExtendedRegisterClass(); + /// Retrives a related instance from a Rich Edit control by sending a EM_GETOLEINTERFACE message. + /// The rich edit control window handle. + /// The instance. + public static IRichEditOle RichEdit_GetOleInterface(HWND hRichEditWnd) + { + IntPtr ptr = IntPtr.Zero; + if (IntPtr.Zero == SendMessage(hRichEditWnd, RichEditMessage.EM_GETOLEINTERFACE, default, ref ptr)) + Win32Error.ThrowLastError(); + return (IRichEditOle)Marshal.GetObjectForIUnknown(ptr); + } + /// /// Contains bidirectional information about a rich edit control. This structure is used by the EM_GETBIDIOPTIONS and EM_SETBIDIOPTIONS /// messages to get and set the bidirectional information for a control. diff --git a/PInvoke/MsftEdit/TOM.cs b/PInvoke/MsftEdit/TOM.cs index cbce5634..5a5d08fd 100644 --- a/PInvoke/MsftEdit/TOM.cs +++ b/PInvoke/MsftEdit/TOM.cs @@ -5,6 +5,13 @@ namespace Vanara.PInvoke; public static partial class MsftEdit { + private const ComInterfaceType dualIntType = +#if NETCOREAPP3_1 + ComInterfaceType.InterfaceIsIUnknown; +#else + ComInterfaceType.InterfaceIsDual; +#endif + /// Retrieves the Unicode Transformation Format (UTF)-32 math alphanumeric character that corresponds to the specified Basic Multilingual Plane (BMP) character and math style. /// /// [in] Type: LONG @@ -1604,7 +1611,7 @@ public static partial class MsftEdit /// This interface is currently undefined. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextdisplays [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextDisplays")] - [ComImport, Guid("C241F5F2-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5F2-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextDisplays { } @@ -1632,7 +1639,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextdocument [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextDocument")] - [ComImport, Guid("8CC497C0-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsDual)] + [ComImport, Guid("8CC497C0-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)] public interface ITextDocument { /// Gets the file name of this document. This is the ITextDocument default property. @@ -1681,7 +1688,7 @@ public static partial class MsftEdit /// To set the saved property, call the ITextDocument::SetSaved method. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getsaved // HRESULT GetSaved( long *pValue ); - int GetSaved(); + tomConstants GetSaved(); /// Sets the document Saved property. /// @@ -1708,7 +1715,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-setsaved // HRESULT SetSaved( [in] long Value ); - void SetSaved(int Value); + void SetSaved(tomConstants Value); /// Gets the default tab width. /// @@ -1772,7 +1779,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-open // HRESULT Open( [in] VARIANT *pVar, long Flags, long CodePage ); - void Open([In] object pVar, tomConstants Flags, uint CodePage); + void Open([In] object pVar, [Optional] tomConstants Flags, [Optional] uint CodePage); /// Saves the document. /// @@ -1948,7 +1955,7 @@ public static partial class MsftEdit /// To set the saved property, call the ITextDocument::SetSaved method. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getsaved // HRESULT GetSaved( long *pValue ); - new int GetSaved(); + new tomConstants GetSaved(); /// Sets the document Saved property. /// @@ -1975,7 +1982,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-setsaved // HRESULT SetSaved( [in] long Value ); - new void SetSaved(int Value); + new void SetSaved(tomConstants Value); /// Gets the default tab width. /// @@ -3084,7 +3091,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextfont [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextFont")] - [ComImport, Guid("8CC497C3-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("8CC497C3-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)] public interface ITextFont { /// Gets a duplicate of this text font object. @@ -4760,7 +4767,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextfont2 [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextFont2")] - [ComImport, Guid("C241F5E3-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5E3-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextFont2 : ITextFont { /// Gets a duplicate of this text font object. @@ -7617,7 +7624,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextpara [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextPara")] - [ComImport, Guid("8CC497C4-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("8CC497C4-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)] public interface ITextPara { /// Creates a duplicate of the specified paragraph format object. The duplicate property is the default property of an ITextPara object. @@ -8223,68 +8230,717 @@ public static partial class MsftEdit // HRESULT SetKeepWithNext( [in] long Value ); void SetKeepWithNext(tomConstants Value); + /// Retrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin. + /// + /// Type: float* + /// The left indentation, in floating-point points. + /// + /// + /// To set the left indentation amount, call the ITextPara::SetIndents method. + /// To get the first-line indent, call ITextPara::GetFirstLineIndent. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getleftindent + // HRESULT GetLeftIndent( float *pValue ); float GetLeftIndent(); + /// Retrieves the line-spacing value for the text range. + /// + /// Type: float* + /// The line-spacing value. The following table shows how this value is interpreted for the different line-spacing rules. + /// + /// + /// Line spacing rule + /// Meaning + /// + /// + /// tomLineSpaceSingle + /// The line-spacing value is ignored. + /// + /// + /// tomLineSpace1pt5 + /// The line-spacing value is ignored. + /// + /// + /// tomLineSpaceDouble + /// The line-spacing value is ignored. + /// + /// + /// tomLineSpaceAtLeast + /// The line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less than single spacing, the control displays single-spaced text. + /// + /// + /// tomLineSpaceExactly + /// The line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is less than single spacing). + /// + /// + /// tomLineSpaceMultiple + /// The line-spacing value specifies the line spacing, in lines. + /// + /// + /// + /// To retrieve the line-spacing rule, call the ITextPara::GetLineSpacingRule method. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacing + // HRESULT GetLineSpacing( float *pValue ); float GetLineSpacing(); - int GetLineSpacingRule(); + /// Retrieves the line-spacing rule for the text range. + /// + /// Type: long* + /// A variable that is one of the following values to indicate the line-spacing rule. + /// tomLineSpaceSingle + /// tomLineSpace1pt5 + /// tomLineSpaceDouble + /// tomLineSpaceAtLeast + /// tomLineSpaceExactly + /// tomLineSpaceMultiple + /// tomLineSpacePercent + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacingrule + // HRESULT GetLineSpacingRule( long *pValue ); + tomConstants GetLineSpacingRule(); - int GetListAlignment(); + /// Retrieves the kind of alignment to use for bulleted and numbered lists. + /// + /// Type: long* + /// A variable that is one of the following values to indicate the kind of bullet and numbering alignment. + /// + /// + /// Value + /// Meaning + /// + /// + /// tomAlignLeft + /// Text is left aligned. + /// + /// + /// tomAlignCenter + /// Text is centered in the line. + /// + /// + /// tomAlignRight + /// Text is right aligned. + /// + /// + /// + /// For a description of the different types of lists, see the ITextPara::GetListType method. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistalignment + // HRESULT GetListAlignment( long *pValue ); + tomConstants GetListAlignment(); - HRESULT SetListAlignment(int Value); + /// Sets the alignment of bulleted or numbered text used for paragraphs. + /// + /// Type: long + /// New list alignment value. For possible values, see ITextPara::GetListAlignment. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistalignment + // HRESULT SetListAlignment( [in] long Value ); + void SetListAlignment(tomConstants Value); + /// Retrieves the list level index used with paragraphs. + /// + /// Type: long* + /// A variable that is the list level index. The value of pValue can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// 0 + /// No list. + /// + /// + /// 1 + /// First-level (outermost) list. + /// + /// + /// 2 + /// Second-level (nested) list. This is nested under a level 1 list item. + /// + /// + /// 3 + /// Third-level (nested) list. This is nested under a level 2 list item. + /// + /// + /// and so forth + /// Nesting continues similarly. + /// + /// + ///  + /// Up to three levels are common in HTML documents. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistlevelindex + // HRESULT GetListLevelIndex( long *pValue ); int GetListLevelIndex(); - HRESULT SetListLevelIndex(int Value); + /// Sets the list level index used for paragraphs. + /// + /// Type: long + /// New list level index value. For possible values, see ITextPara::GetListLevelIndex. + /// + /// Setting the list level index does not automatically change a list's indentation and other paragraph properties. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistlevelindex + // HRESULT SetListLevelIndex( [in] long Value ); + void SetListLevelIndex(int Value); - int GetListStart(); + /// Retrieves the starting value or code of a list numbering sequence. + /// + /// Type: long* + /// The starting value or code of a list numbering sequence. For the possible values, see the ITextPara::GetListType method. + /// + /// For a discussion on which sequence to use, see the ITextPara::GetListType method. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getliststart + // HRESULT GetListStart( long *pValue ); + tomConstants GetListStart(); - HRESULT SetListStart(int Value); + /// Sets the starting number or Unicode value for a numbered list. + /// + /// Type: long + /// New starting number or Unicode value for a numbered list. + /// + /// Other characteristics of a list are specified by ITextPara::SetListType. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setliststart + // HRESULT SetListStart( [in] long Value ); + void SetListStart(tomConstants Value); + /// Retrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered or bulleted text is left-justified, centered, or right-justified at the first-line indent value. + /// + /// Type: float* + /// The list tab setting. The list tab value is in floating-point points. + /// + /// To determine whether the numbered or bulleted text is left-justified, centered, or right-justified, call ITextPara::GetListAlignment. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttab + // HRESULT GetListTab( float *pValue ); float GetListTab(); - HRESULT SetListTab(float Value); + /// Sets the list tab setting, which is the distance between the first indent and the start of the text on the first line. + /// + /// Type: float + /// New list tab value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttab + // HRESULT SetListTab( [in] float Value ); + void SetListTab(float Value); - int GetListType(); + /// Retrieves the kind of numbering to use with paragraphs. + /// + /// Type: long* + /// A variable that is of the following values to indicate the kind of list numbering. + /// tomListNone + /// tomListBullet + /// tomListNumberAsArabic + /// tomListNumberAsLCLetter + /// tomListNumberAsUCLetter + /// tomListNumberAsLCRoman + /// tomListNumberAsUCRoman + /// tomListNumberAsSequence + /// tomListNumberedCircle + /// tomListNumberedBlackCircleWingding + /// tomListNumberedWhiteCircleWingding + /// tomListNumberedArabicWide + /// tomListNumberedChS + /// tomListNumberedChT + /// tomListNumberedJpnChs + /// tomListNumberedJpnKor + /// tomListNumberedArabic1 + /// tomListNumberedArabic2 + /// tomListNumberedHebrew + /// tomListNumberedThaiAlpha + /// tomListNumberedThaiNum + /// tomListNumberedHindiAlpha + /// tomListNumberedHindiAlpha1 + /// tomListNumberedHindiNum + /// By default, numbers are followed by a right parenthesis, for example: 1). However, pValue can include one of the following flags to indicate a different formatting. + /// tomListMinus + /// tomListParentheses + /// tomListPeriod + /// tomListPlain + /// + /// + /// Values above 32 correspond to Unicode values for bullets. + /// The mobile Microsoft Office version of the rich edit control uses tomIgnoreNumberStyle to suppress setting the style. + /// The following Microsoft Visual Basic for Applications (VBA) example numbers the paragraphs in a range, starting with the number 2 and following the numbers with a period. + /// For an example of tomListNumberAsSequence, set to 0x2780, which gives you circled numbers. The Unicode Standard has examples of many more numbering sequences. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttype + // HRESULT GetListType( long *pValue ); + tomConstants GetListType(); - HRESULT SetListType(int Value); + /// Sets the type of list to be used for paragraphs. + /// + /// Type: long + /// New list type. For possible list types, see the ITextPara::GetListType method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttype + // HRESULT SetListType( [in] long Value ); + void SetListType(tomConstants Value); - int GetNoLineNumber(); + /// Determines whether paragraph numbering is enabled. + /// + /// Type: long* + /// A variable that is one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// tomTrue + /// Line numbering is disabled. + /// + /// + /// tomFalse + /// Line numbering is enabled. + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + /// Paragraph numbering is when the paragraphs of a range are numbered. The number appears on the first line of a paragraph. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getnolinenumber + // HRESULT GetNoLineNumber( long *pValue ); + tomConstants GetNoLineNumber(); - HRESULT SetNoLineNumber(int Value); + /// Determines whether to suppress line numbering of paragraphs in a range. + /// + /// Type: long + /// Indicates if line numbering is suppressed. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Line numbering is disabled. + /// + /// + /// + /// tomFalse + /// Line numbering is enabled. + /// + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + /// This property concerns the numbering of paragraphs in a range. If Value is tomFalse, the number of the paragraph appears on the first line of the paragraph. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setnolinenumber + // HRESULT SetNoLineNumber( [in] long Value ); + void SetNoLineNumber(tomConstants Value); - int GetPageBreakBefore(); + /// Determines whether each paragraph in the range must begin on a new page. + /// + /// Type: long* + /// A variable that is one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// tomTrue + /// Each paragraph in this range must begin on a new page. + /// + /// + /// tomFalse + /// The paragraphs in this range do not need to begin on a new page. + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getpagebreakbefore + // HRESULT GetPageBreakBefore( long *pValue ); + tomConstants GetPageBreakBefore(); - HRESULT SetPageBreakBefore(int Value); + /// Controls whether there is a page break before each paragraph in a range. + /// + /// Type: long + /// A tomBool value that controls page breaks before paragraphs. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Paragraphs in this range must begin on a new page. + /// + /// + /// + /// tomFalse + /// + /// Paragraphs in this range do not need to begin on a new page. + /// + /// + /// + /// tomToggle + /// + /// Toggle the property value. + /// + /// + /// + /// tomUndefined + /// + /// The property is undefined. + /// + /// + /// + /// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setpagebreakbefore + // HRESULT SetPageBreakBefore( [in] long Value ); + void SetPageBreakBefore(tomConstants Value); + /// Retrieves the size of the right margin indent of a paragraph. + /// + /// Type: float* + /// The right indentation, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getrightindent + // HRESULT GetRightIndent( float *pValue ); float GetRightIndent(); - HRESULT SetRightIndent(float Value); + /// Sets the right margin of paragraph. + /// + /// Type: float + /// Right indent, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setrightindent + // HRESULT SetRightIndent( [in] float Value ); + void SetRightIndent(float Value); - HRESULT SetIndents(float First, float Left, float Right); + /// Sets the first-line indent, the left indent, and the right indent for a paragraph. + /// + /// Type: float + /// Indent of the first line in a paragraph, relative to the left indent. The value is in floating-point points and can be positive or negative. + /// + /// + /// Type: float + /// Left indent of all lines except the first line in a paragraph, relative to left margin. The value is in floating-point points and can be positive or negative. + /// + /// + /// Type: float + /// Right indent of all lines in paragraph, relative to the right margin. The value is in floating-point points and can be positive or negative. This value is optional. + /// + /// Line indents are not allowed to position text in the margins. If the first-line indent is set to a negative value (for an outdented paragraph) while the left indent is zero, the first-line indent is reset to zero. To avoid this problem while retaining property sets, set the first-line indent value equal to zero either explicitly or by calling the ITextPara::Reset method. Then, call ITextPara::SetIndents to set a nonnegative, left-indent value and set the desired first-line indent. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setindents + // HRESULT SetIndents( [in] float First, [in] float Left, [in] float Right ); + void SetIndents(float First, float Left, float Right); - HRESULT SetLineSpacing(int Rule, float Spacing); + /// Sets the paragraph line-spacing rule and the line spacing for a paragraph. + /// + /// Type: long + /// Value of new line-spacing rule. For a list of possible rule values and further discussion, see the ITextPara::GetLineSpacingRule method. + /// + /// + /// Type: float + /// Value of new line spacing. If the line-spacing rule treats the Spacing value as a linear dimension, then Spacing is given in floating-point points. + /// + /// The line-spacing rule and line spacing work together, and as a result, they must be set together, much as the first and left indents need to be set together. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlinespacing + // HRESULT SetLineSpacing( [in] long Rule, [in] float Spacing ); + void SetLineSpacing(tomConstants Rule, float Spacing); + /// Retrieves the amount of vertical space below a paragraph. + /// + /// Type: float* + /// The space-after value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspaceafter + // HRESULT GetSpaceAfter( float *pValue ); float GetSpaceAfter(); - HRESULT SetSpaceAfter(float Value); + /// Sets the amount of space that follows a paragraph. + /// + /// Type: float + /// New space-after value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspaceafter + // HRESULT SetSpaceAfter( [in] float Value ); + void SetSpaceAfter(float Value); + /// Retrieves the amount of vertical space above a paragraph. + /// + /// Type: float* + /// The space-before value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspacebefore + // HRESULT GetSpaceBefore( float *pValue ); float GetSpaceBefore(); - HRESULT SetSpaceBefore(float Value); + /// Sets the amount of space preceding a paragraph. + /// + /// Type: float + /// New space-before value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspacebefore + // HRESULT SetSpaceBefore( [in] float Value ); + void SetSpaceBefore(float Value); - int GetWidowControl(); + /// Retrieves the widow and orphan control state for the paragraphs in a range. + /// + /// Type: long* + /// A tomBool value that indicates the state of widow and orphan control. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Prevents the printing of a widow or orphan + /// + /// + /// + /// tomFalse + /// + /// Allows the printing of a widow or orphan. + /// + /// + /// + /// tomUndefined + /// + /// The widow-control property is undefined. + /// + /// + /// + /// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line of a paragraph is printed by itself at the bottom of a page. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getwidowcontrol + // HRESULT GetWidowControl( long *pValue ); + tomConstants GetWidowControl(); - HRESULT SetWidowControl(int Value); + /// Controls the suppression of widows and orphans. + /// + /// Type: long + /// A tomBool value that controls the suppression of widows and orphans. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Prevents printing of widows and orphans. + /// + /// + /// + /// tomFalse + /// Allows printing of widows and orphans. + /// + /// + /// + /// tomToggle + /// The value is toggled. + /// + /// + /// + /// tomUndefined + /// No change. + /// + /// + /// + /// + /// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text. + /// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line of a paragraph is printed by itself at the bottom of a page. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setwidowcontrol + // HRESULT SetWidowControl( [in] long Value ); + void SetWidowControl(tomConstants Value); + /// Retrieves the tab count. + /// + /// Type: long* + /// The tab count. + /// + /// The tab count of a new instance can be nonzero, depending on the underlying text engine. For example, Microsoft Word stories begin with no explicit tabs defined, while rich edit instances start with a single explicit tab. To be sure there are no explicit tabs (that is, to set the tab count to zero), call ITextPara::ClearAllTabs. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettabcount + // HRESULT GetTabCount( long *pCount ); int GetTabCount(); - HRESULT AddTab(float tbPos, int tbAlign, int tbLeader); + /// Adds a tab at the displacement tbPos, with type tbAlign, and leader style, tbLeader. + /// + /// Type: float + /// New tab displacement, in floating-point points. + /// + /// + /// Type: long + /// Alignment options for the tab position. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomAlignLeft + /// + /// Text is left justified from the tab position. This is the default. + /// + /// + /// + /// tomAlignCenter + /// + /// Text is centered on the tab position. + /// + /// + /// + /// tomAlignRight + /// + /// Text is right justified from the tab position. + /// + /// + /// + /// tomAlignDecimal + /// + /// The decimal point is set at the tab position. This is useful for aligning a column of decimal numbers. + /// + /// + /// + /// tomAlignBar + /// + /// A vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form a continuous vertical line. + /// + /// + /// + /// + /// Type: long + /// Leader character style. A leader character is the character that is used to fill the space taken by a tab character. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomSpaces + /// + /// Spaces are used. This is the default. + /// + /// + /// + /// tomDots + /// + /// Dots are used. + /// + /// + /// + /// tomDashes + /// + /// A dashed line is used. + /// + /// + /// + /// tomLines + /// + /// A solid line is used. + /// + /// + /// + /// It is assumed that there is never a tab at position zero. If multiple paragraphs are described, the common subset of tabs will be returned with 0x8000 in the upper word of the tab type. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-addtab + // HRESULT AddTab( [in] float tbPos, [in] long tbAlign, [in] long tbLeader ); + void AddTab(float tbPos, tomConstants tbAlign, tomConstants tbLeader); - HRESULT ClearAllTabs(); + /// Clears all tabs, reverting to equally spaced tabs with the default tab spacing. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-clearalltabs + // HRESULT ClearAllTabs(); + void ClearAllTabs(); - HRESULT DeleteTab(float tbPos); + /// Deletes a tab at a specified displacement. + /// + /// Type: float + /// Displacement, in floating-point points, at which a tab should be deleted. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-deletetab + // HRESULT DeleteTab( float tbPos ); + void DeleteTab(float tbPos); + /// Retrieves tab parameters (displacement, alignment, and leader style) for a specified tab. + /// + /// Type: long + /// Index of tab for which to retrieve info. It can be either a numerical index or a special value (see the following table). Since tab indexes are zero-based, iTab = zero gets the first tab defined, iTab = 1 gets the second tab defined, and so forth. The following table summarizes all of the possible values of iTab. + /// + /// + /// iTab + /// Value + /// Meaning + /// + /// + /// tomTabBack + /// –3 + /// Get tab previous to * ptbPos + /// + /// + /// tomTabNext + /// –2 + /// Get tab following * ptbPos + /// + /// + /// tomTabHere + /// –1 + /// Get tab at * ptbPos + /// + /// + /// + /// >= 0 + /// Get tab with index of iTab (and ignore ptbPos). + /// + /// + /// + /// + /// Type: float* + /// The tab displacement, in floating-point points. The value of * ptbPos is zero if the tab does not exist and the value of * ptbPos is tomUndefined if there are multiple values in the associated range. + /// + /// + /// Type: long* + /// The tab alignment. For more information, see ITextPara::AddTab. + /// + /// + /// Type: long* + /// The tab leader-character style. For more information, see ITextPara::AddTab. + /// + /// + /// Type: HRESULT + /// If ITextPara::GetTab succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes. For more information about COM error codes, see Error Handling in COM. + /// + /// + /// Return code + /// Description + /// + /// + /// Value + /// Meaning + /// + /// + /// E_INVALIDARG + /// Invalid argument. + /// + /// + /// CO_E_RELEASED + /// The paragraph formatting object is attached to a range that has been deleted. + /// + /// + /// S_FALSE + /// There is no tab corresponding to iTab. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettab + // HRESULT GetTab( long iTab, float *ptbPos, long *ptbAlign, long *ptbLeader ); + [PreserveSig] HRESULT GetTab(int iTab, out float ptbPos, out int ptbAlign, out int ptbLeader); } @@ -8294,55 +8950,1717 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextpara2 [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextPara2")] - [ComImport, Guid("C241F5E4-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5E4-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextPara2 : ITextPara { - /// - /// Not implemented. - /// Gets the borders collection. - /// - /// - /// Type: IUnknown** - /// The borders collection. + /// Creates a duplicate of the specified paragraph format object. The duplicate property is the default property of an ITextPara object. + /// + /// Type: ITextPara** + /// The duplicate ITextPara object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getduplicate + // HRESULT GetDuplicate( ITextPara **ppPara ); + new ITextPara GetDuplicate(); + + /// Sets the formatting for an existing paragraph by copying a given format. + /// + /// Type: ITextPara* + /// The ITextPara range that contains the new paragraph formatting. + /// + /// The tomUndefined values have no effect, that is, they will not change the target values. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setduplicate + // HRESULT SetDuplicate( [in] ITextPara *pPara ); + new void SetDuplicate([In, Optional] ITextPara? pPara); + + /// Determines whether the paragraph formatting can be changed. + /// + /// Type: long* + /// A variable that is tomTrue if the paragraph formatting can be changed or tomFalse if it cannot be changed. This parameter can be null. /// /// /// Type: HRESULT - /// If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code. + /// If paragraph formatting can change, ITextPara::CanChange succeeds and returns S_OK. If paragraph formatting cannot change, the method fails and returns S_FALSE. For more information about COM error codes, see Error Handling in COM. + /// + /// The *pbCanChange parameter returns tomTrue only if the paragraph formatting can be changed (that is, if no part of an associated range is protected and an associated document is not read-only). If this ITextPara object is a duplicate, no protection rules apply. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-canchange + // HRESULT CanChange( [retval] long *pValue ); + [PreserveSig] + new HRESULT CanChange(out tomConstants pValue); + + /// Determines if the current range has the same properties as a specified range. + /// + /// Type: ITextPara* + /// The ITextPara range that is compared to the current range. + /// + /// + /// Type: long* + /// The comparison result. The value can be null. + /// + /// + /// Type: HRESULT + /// If the objects are equal, ITextPara::IsEqual succeeds and returns S_OK. If the objects are not equal, the method fails and returns S_FALSE. For more information about COM error codes, see Error Handling in COM. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-isequal + // HRESULT IsEqual( ITextPara *pPara, long *pValue ); + [PreserveSig] + new HRESULT IsEqual([In, Optional] ITextPara? pPara, out int pValue); + + /// Resets the paragraph formatting to a choice of default values. + /// + /// Type: long + /// Type of reset. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomDefault + /// Used for paragraph formatting that is defined by the RTF \pard, that is, the paragraph default control word. + /// + /// + /// + /// tomUndefined + /// Used for all undefined values. The tomUndefined value is only valid for duplicate (clone) ITextPara objects. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-reset + // HRESULT Reset( [in] long Value ); + new void Reset(tomConstants Value); + + /// Retrieves the style handle to the paragraphs in the specified range. + /// + /// Type: long* + /// The paragraph style handle. For more information, see the Remarks. + /// + /// + /// The Text Object Model (TOM) version 1.0 has no way to specify the meanings of user-defined style handles. They depend on other facilities of the text system implementing TOM. Negative style handles are reserved for built-in character and paragraph styles. Currently defined values are listed in the following table. For a description of the following styles, see the Microsoft Word documentation. + /// + /// + /// Style + /// Value + /// Style + /// Value + /// + /// + /// StyleNormal + /// –1 + /// StyleTableofAuthorities + /// –45 + /// + /// + /// StyleHeading1 + /// –2 + /// StyleMacroText + /// –46 + /// + /// + /// StyleHeading2 + /// –3 + /// StyleTOAHeading + /// –47 + /// + /// + /// StyleHeading3 + /// –4 + /// StyleList + /// –48 + /// + /// + /// StyleHeading4 + /// –5 + /// StyleListBullet + /// –49 + /// + /// + /// StyleHeading5 + /// –6 + /// StyleListNumber + /// –50 + /// + /// + /// StyleHeading6 + /// –7 + /// StyleList2 + /// –51 + /// + /// + /// StyleHeading7 + /// –8 + /// StyleList3 + /// –52 + /// + /// + /// StyleHeading8 + /// –9 + /// StyleList4 + /// –53 + /// + /// + /// StyleHeading9 + /// –10 + /// StyleList5 + /// –54 + /// + /// + /// StyleIndex1 + /// –11 + /// StyleListBullet2 + /// –55 + /// + /// + /// StyleIndex2 + /// –12 + /// StyleListBullet3 + /// –56 + /// + /// + /// StyleIndex3 + /// –13 + /// StyleListBullet4 + /// –57 + /// + /// + /// StyleIndex4 + /// –14 + /// StyleListBullet5 + /// –58 + /// + /// + /// StyleIndex5 + /// –15 + /// StyleListNumber2 + /// –59 + /// + /// + /// StyleIndex6 + /// –16 + /// StyleListNumber3 + /// –60 + /// + /// + /// StyleIndex7 + /// –17 + /// StyleListNumber4 + /// –61 + /// + /// + /// StyleIndex8 + /// –18 + /// StyleListNumber5 + /// –62 + /// + /// + /// StyleIndex9 + /// –19 + /// StyleTitle + /// –63 + /// + /// + /// StyleTOC1 + /// –20 + /// StyleClosing + /// –64 + /// + /// + /// StyleTOC2 + /// –21 + /// StyleSignature + /// –65 + /// + /// + /// StyleTOC3 + /// –22 + /// StyleDefaultParagraphFont + /// –66 + /// + /// + /// StyleTOC4 + /// –23 + /// StyleBodyText + /// –67 + /// + /// + /// StyleTOC5 + /// –24 + /// StyleBodyTextIndent + /// –68 + /// + /// + /// StyleTOC6 + /// –25 + /// StyleListContinue + /// –69 + /// + /// + /// StyleTOC7 + /// –26 + /// StyleListContinue2 + /// –70 + /// + /// + /// StyleTOC8 + /// –27 + /// StyleListContinue3 + /// –71 + /// + /// + /// StyleTOC9 + /// –28 + /// StyleListContinue4 + /// –72 + /// + /// + /// StyleNormalIndent + /// –29 + /// StyleListContinue5 + /// –73 + /// + /// + /// StyleFootnoteText + /// –30 + /// StyleMessageHeader + /// –74 + /// + /// + /// StyleAnnotationText + /// –31 + /// StyleSubtitle + /// –75 + /// + /// + /// StyleHeader + /// –32 + /// StyleSalutation + /// –76 + /// + /// + /// StyleFooter + /// –33 + /// StyleDate + /// –77 + /// + /// + /// StyleIndexHeading + /// –34 + /// StyleBodyTextFirstIndent + /// –78 + /// + /// + /// StyleCaption + /// –35 + /// StyleBodyTextFirstIndent2 + /// –79 + /// + /// + /// StyleTableofFigures + /// –36 + /// StyleNoteHeading + /// –80 + /// + /// + /// StyleEnvelopeAddress + /// –37 + /// StyleBodyText2 + /// –81 + /// + /// + /// StyleEnvelopeReturn + /// –38 + /// StyleBodyText3 + /// –82 + /// + /// + /// StyleFootnoteReference + /// –39 + /// StyleBodyTextIndent2 + /// –83 + /// + /// + /// StyleAnnotationReference + /// –40 + /// StyleBodyTextIndent3 + /// –84 + /// + /// + /// StyleLineNumber + /// –41 + /// StyleBlockQuotation + /// –85 + /// + /// + /// StylePageNumber + /// –42 + /// StyleHyperlink + /// –86 + /// + /// + /// StyleEndnoteReference + /// –43 + /// StyleHyperlinkFollowed + /// –87 + /// + /// + /// StyleEndnoteText + /// –44 + ///  + ///  + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getstyle + // HRESULT GetStyle( long *pValue ); + new int GetStyle(); + + /// Sets the paragraph style for the paragraphs in a range. + /// + /// Type: long + /// New paragraph style handle. For a list of styles, see the Remarks section of ITextPara::GetStyle. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setstyle + // HRESULT SetStyle( [in] long Value ); + new void SetStyle(int Value); + + /// Retrieves the current paragraph alignment value. + /// + /// Type: long* + /// The paragraph alignment, which can be one of the following values. + /// tomAlignLeft + /// tomAlignCenter + /// tomAlignRight + /// tomAlignJustify + /// tomAlignInterWord + /// tomAlignNewspaper + /// tomAlignInterLetter + /// tomAlignScaled + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getalignment + // HRESULT GetAlignment( long *pValue ); + new tomConstants GetAlignment(); + + /// Sets the paragraph alignment. + /// + /// Type: long + /// New paragraph alignment. For a list of possible values, see the ITextPara::GetAlignment method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setalignment + // HRESULT SetAlignment( [in] long Value ); + new void SetAlignment(tomConstants Value); + + /// Determines whether automatic hyphenation is enabled for the range. + /// + /// Type: long* + /// A variable that is one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Automatic hyphenation is enabled. + /// + /// + /// + /// tomFalse + /// + /// Automatic hyphenation is disabled. + /// + /// + /// + /// tomUndefined + /// + /// The hyphenation property is undefined. + /// + /// + /// + /// This property corresponds to the PFE_DONOTHYPHEN effect described in the PARAFORMAT2 structure. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gethyphenation + // HRESULT GetHyphenation( long *pValue ); + new tomConstants GetHyphenation(); + + /// Controls hyphenation for the paragraphs in the range. + /// + /// Type: long + /// Indicates how hyphenation is controlled. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Automatic hyphenation is enabled. + /// + /// + /// + /// tomFalse + /// Automatic hyphenation is disabled. + /// + /// + /// + /// tomUndefined + /// The hyphenation property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-sethyphenation + // HRESULT SetHyphenation( [in] long Value ); + new void SetHyphenation(tomConstants Value); + + /// Retrieves the amount used to indent the first line of a paragraph relative to the left indent. The left indent is the indent for all lines of the paragraph except the first line. + /// + /// Type: float* + /// The first-line indentation amount in floating-point points. + /// + /// + /// To set the first line indentation amount, call the ITextPara::SetIndents method. + /// To get and set the indent for all other lines of the paragraph (that is, the left indent), use ITextPara::GetLeftIndent and ITextPara::SetIndents. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getfirstlineindent + // HRESULT GetFirstLineIndent( float *pValue ); + new float GetFirstLineIndent(); + + /// Determines whether page breaks are allowed within paragraphs. + /// + /// Type: long* + /// A variable that is one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Page breaks are not allowed within a paragraph. + /// + /// + /// + /// tomFalse + /// + /// Page breaks are allowed within a paragraph. + /// + /// + /// + /// tomUndefined + /// + /// The property is undefined. + /// + /// + /// + /// This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getkeeptogether + // HRESULT GetKeepTogether( long *pValue ); + new tomConstants GetKeepTogether(); + + /// Controls whether page breaks are allowed within a paragraph in a range. + /// + /// Type: long + /// Indicates whether page breaks are allowed within a paragraph in a range. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Page breaks are not allowed within a paragraph. + /// + /// + /// + /// tomFalse + /// Page breaks are allowed within a paragraph. + /// + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + /// This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setkeeptogether + // HRESULT SetKeepTogether( [in] long Value ); + new void SetKeepTogether(tomConstants Value); + + /// Determines whether page breaks are allowed between paragraphs in the range. + /// + /// Type: long* + /// A variable that is one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Page breaks are not allowed between paragraphs. + /// + /// + /// + /// tomFalse + /// + /// Page breaks are allowed between paragraphs. + /// + /// + /// + /// tomUndefined + /// + /// The property is undefined. + /// + /// + /// + /// This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getkeepwithnext + // HRESULT GetKeepWithNext( long *pValue ); + new int GetKeepWithNext(); + + /// Controls whether page breaks are allowed between the paragraphs in a range. + /// + /// Type: long + /// Indicates if page breaks can be used between the paragraphs of a range. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Page breaks are not allowed between paragraphs. + /// + /// + /// + /// tomFalse + /// Page breaks are allowed between paragraphs. + /// + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + /// This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setkeepwithnext + // HRESULT SetKeepWithNext( [in] long Value ); + new void SetKeepWithNext(tomConstants Value); + + /// Retrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin. + /// + /// Type: float* + /// The left indentation, in floating-point points. + /// + /// + /// To set the left indentation amount, call the ITextPara::SetIndents method. + /// To get the first-line indent, call ITextPara::GetFirstLineIndent. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getleftindent + // HRESULT GetLeftIndent( float *pValue ); + new float GetLeftIndent(); + + /// Retrieves the line-spacing value for the text range. + /// + /// Type: float* + /// The line-spacing value. The following table shows how this value is interpreted for the different line-spacing rules. + /// + /// + /// Line spacing rule + /// Meaning + /// + /// + /// tomLineSpaceSingle + /// The line-spacing value is ignored. + /// + /// + /// tomLineSpace1pt5 + /// The line-spacing value is ignored. + /// + /// + /// tomLineSpaceDouble + /// The line-spacing value is ignored. + /// + /// + /// tomLineSpaceAtLeast + /// The line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less than single spacing, the control displays single-spaced text. + /// + /// + /// tomLineSpaceExactly + /// The line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is less than single spacing). + /// + /// + /// tomLineSpaceMultiple + /// The line-spacing value specifies the line spacing, in lines. + /// + /// + /// + /// To retrieve the line-spacing rule, call the ITextPara::GetLineSpacingRule method. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacing + // HRESULT GetLineSpacing( float *pValue ); + new float GetLineSpacing(); + + /// Retrieves the line-spacing rule for the text range. + /// + /// Type: long* + /// A variable that is one of the following values to indicate the line-spacing rule. + /// tomLineSpaceSingle + /// tomLineSpace1pt5 + /// tomLineSpaceDouble + /// tomLineSpaceAtLeast + /// tomLineSpaceExactly + /// tomLineSpaceMultiple + /// tomLineSpacePercent + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacingrule + // HRESULT GetLineSpacingRule( long *pValue ); + new tomConstants GetLineSpacingRule(); + + /// Retrieves the kind of alignment to use for bulleted and numbered lists. + /// + /// Type: long* + /// A variable that is one of the following values to indicate the kind of bullet and numbering alignment. + /// + /// + /// Value + /// Meaning + /// + /// + /// tomAlignLeft + /// Text is left aligned. + /// + /// + /// tomAlignCenter + /// Text is centered in the line. + /// + /// + /// tomAlignRight + /// Text is right aligned. + /// + /// + /// + /// For a description of the different types of lists, see the ITextPara::GetListType method. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistalignment + // HRESULT GetListAlignment( long *pValue ); + new tomConstants GetListAlignment(); + + /// Sets the alignment of bulleted or numbered text used for paragraphs. + /// + /// Type: long + /// New list alignment value. For possible values, see ITextPara::GetListAlignment. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistalignment + // HRESULT SetListAlignment( [in] long Value ); + new void SetListAlignment(tomConstants Value); + + /// Retrieves the list level index used with paragraphs. + /// + /// Type: long* + /// A variable that is the list level index. The value of pValue can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// 0 + /// No list. + /// + /// + /// 1 + /// First-level (outermost) list. + /// + /// + /// 2 + /// Second-level (nested) list. This is nested under a level 1 list item. + /// + /// + /// 3 + /// Third-level (nested) list. This is nested under a level 2 list item. + /// + /// + /// and so forth + /// Nesting continues similarly. + /// + /// + ///  + /// Up to three levels are common in HTML documents. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistlevelindex + // HRESULT GetListLevelIndex( long *pValue ); + new int GetListLevelIndex(); + + /// Sets the list level index used for paragraphs. + /// + /// Type: long + /// New list level index value. For possible values, see ITextPara::GetListLevelIndex. + /// + /// Setting the list level index does not automatically change a list's indentation and other paragraph properties. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistlevelindex + // HRESULT SetListLevelIndex( [in] long Value ); + new void SetListLevelIndex(int Value); + + /// Retrieves the starting value or code of a list numbering sequence. + /// + /// Type: long* + /// The starting value or code of a list numbering sequence. For the possible values, see the ITextPara::GetListType method. + /// + /// For a discussion on which sequence to use, see the ITextPara::GetListType method. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getliststart + // HRESULT GetListStart( long *pValue ); + new tomConstants GetListStart(); + + /// Sets the starting number or Unicode value for a numbered list. + /// + /// Type: long + /// New starting number or Unicode value for a numbered list. + /// + /// Other characteristics of a list are specified by ITextPara::SetListType. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setliststart + // HRESULT SetListStart( [in] long Value ); + new void SetListStart(tomConstants Value); + + /// Retrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered or bulleted text is left-justified, centered, or right-justified at the first-line indent value. + /// + /// Type: float* + /// The list tab setting. The list tab value is in floating-point points. + /// + /// To determine whether the numbered or bulleted text is left-justified, centered, or right-justified, call ITextPara::GetListAlignment. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttab + // HRESULT GetListTab( float *pValue ); + new float GetListTab(); + + /// Sets the list tab setting, which is the distance between the first indent and the start of the text on the first line. + /// + /// Type: float + /// New list tab value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttab + // HRESULT SetListTab( [in] float Value ); + new void SetListTab(float Value); + + /// Retrieves the kind of numbering to use with paragraphs. + /// + /// Type: long* + /// A variable that is of the following values to indicate the kind of list numbering. + /// tomListNone + /// tomListBullet + /// tomListNumberAsArabic + /// tomListNumberAsLCLetter + /// tomListNumberAsUCLetter + /// tomListNumberAsLCRoman + /// tomListNumberAsUCRoman + /// tomListNumberAsSequence + /// tomListNumberedCircle + /// tomListNumberedBlackCircleWingding + /// tomListNumberedWhiteCircleWingding + /// tomListNumberedArabicWide + /// tomListNumberedChS + /// tomListNumberedChT + /// tomListNumberedJpnChs + /// tomListNumberedJpnKor + /// tomListNumberedArabic1 + /// tomListNumberedArabic2 + /// tomListNumberedHebrew + /// tomListNumberedThaiAlpha + /// tomListNumberedThaiNum + /// tomListNumberedHindiAlpha + /// tomListNumberedHindiAlpha1 + /// tomListNumberedHindiNum + /// By default, numbers are followed by a right parenthesis, for example: 1). However, pValue can include one of the following flags to indicate a different formatting. + /// tomListMinus + /// tomListParentheses + /// tomListPeriod + /// tomListPlain + /// + /// + /// Values above 32 correspond to Unicode values for bullets. + /// The mobile Microsoft Office version of the rich edit control uses tomIgnoreNumberStyle to suppress setting the style. + /// The following Microsoft Visual Basic for Applications (VBA) example numbers the paragraphs in a range, starting with the number 2 and following the numbers with a period. + /// For an example of tomListNumberAsSequence, set to 0x2780, which gives you circled numbers. The Unicode Standard has examples of many more numbering sequences. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttype + // HRESULT GetListType( long *pValue ); + new tomConstants GetListType(); + + /// Sets the type of list to be used for paragraphs. + /// + /// Type: long + /// New list type. For possible list types, see the ITextPara::GetListType method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttype + // HRESULT SetListType( [in] long Value ); + new void SetListType(tomConstants Value); + + /// Determines whether paragraph numbering is enabled. + /// + /// Type: long* + /// A variable that is one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// tomTrue + /// Line numbering is disabled. + /// + /// + /// tomFalse + /// Line numbering is enabled. + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + /// Paragraph numbering is when the paragraphs of a range are numbered. The number appears on the first line of a paragraph. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getnolinenumber + // HRESULT GetNoLineNumber( long *pValue ); + new tomConstants GetNoLineNumber(); + + /// Determines whether to suppress line numbering of paragraphs in a range. + /// + /// Type: long + /// Indicates if line numbering is suppressed. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Line numbering is disabled. + /// + /// + /// + /// tomFalse + /// Line numbering is enabled. + /// + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + /// This property concerns the numbering of paragraphs in a range. If Value is tomFalse, the number of the paragraph appears on the first line of the paragraph. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setnolinenumber + // HRESULT SetNoLineNumber( [in] long Value ); + new void SetNoLineNumber(tomConstants Value); + + /// Determines whether each paragraph in the range must begin on a new page. + /// + /// Type: long* + /// A variable that is one of the following values: + /// + /// + /// Value + /// Meaning + /// + /// + /// tomTrue + /// Each paragraph in this range must begin on a new page. + /// + /// + /// tomFalse + /// The paragraphs in this range do not need to begin on a new page. + /// + /// + /// tomUndefined + /// The property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getpagebreakbefore + // HRESULT GetPageBreakBefore( long *pValue ); + new tomConstants GetPageBreakBefore(); + + /// Controls whether there is a page break before each paragraph in a range. + /// + /// Type: long + /// A tomBool value that controls page breaks before paragraphs. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Paragraphs in this range must begin on a new page. + /// + /// + /// + /// tomFalse + /// + /// Paragraphs in this range do not need to begin on a new page. + /// + /// + /// + /// tomToggle + /// + /// Toggle the property value. + /// + /// + /// + /// tomUndefined + /// + /// The property is undefined. + /// + /// + /// + /// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setpagebreakbefore + // HRESULT SetPageBreakBefore( [in] long Value ); + new void SetPageBreakBefore(tomConstants Value); + + /// Retrieves the size of the right margin indent of a paragraph. + /// + /// Type: float* + /// The right indentation, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getrightindent + // HRESULT GetRightIndent( float *pValue ); + new float GetRightIndent(); + + /// Sets the right margin of paragraph. + /// + /// Type: float + /// Right indent, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setrightindent + // HRESULT SetRightIndent( [in] float Value ); + new void SetRightIndent(float Value); + + /// Sets the first-line indent, the left indent, and the right indent for a paragraph. + /// + /// Type: float + /// Indent of the first line in a paragraph, relative to the left indent. The value is in floating-point points and can be positive or negative. + /// + /// + /// Type: float + /// Left indent of all lines except the first line in a paragraph, relative to left margin. The value is in floating-point points and can be positive or negative. + /// + /// + /// Type: float + /// Right indent of all lines in paragraph, relative to the right margin. The value is in floating-point points and can be positive or negative. This value is optional. + /// + /// Line indents are not allowed to position text in the margins. If the first-line indent is set to a negative value (for an outdented paragraph) while the left indent is zero, the first-line indent is reset to zero. To avoid this problem while retaining property sets, set the first-line indent value equal to zero either explicitly or by calling the ITextPara::Reset method. Then, call ITextPara::SetIndents to set a nonnegative, left-indent value and set the desired first-line indent. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setindents + // HRESULT SetIndents( [in] float First, [in] float Left, [in] float Right ); + new void SetIndents(float First, float Left, float Right); + + /// Sets the paragraph line-spacing rule and the line spacing for a paragraph. + /// + /// Type: long + /// Value of new line-spacing rule. For a list of possible rule values and further discussion, see the ITextPara::GetLineSpacingRule method. + /// + /// + /// Type: float + /// Value of new line spacing. If the line-spacing rule treats the Spacing value as a linear dimension, then Spacing is given in floating-point points. + /// + /// The line-spacing rule and line spacing work together, and as a result, they must be set together, much as the first and left indents need to be set together. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlinespacing + // HRESULT SetLineSpacing( [in] long Rule, [in] float Spacing ); + new void SetLineSpacing(tomConstants Rule, float Spacing); + + /// Retrieves the amount of vertical space below a paragraph. + /// + /// Type: float* + /// The space-after value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspaceafter + // HRESULT GetSpaceAfter( float *pValue ); + new float GetSpaceAfter(); + + /// Sets the amount of space that follows a paragraph. + /// + /// Type: float + /// New space-after value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspaceafter + // HRESULT SetSpaceAfter( [in] float Value ); + new void SetSpaceAfter(float Value); + + /// Retrieves the amount of vertical space above a paragraph. + /// + /// Type: float* + /// The space-before value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspacebefore + // HRESULT GetSpaceBefore( float *pValue ); + new float GetSpaceBefore(); + + /// Sets the amount of space preceding a paragraph. + /// + /// Type: float + /// New space-before value, in floating-point points. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspacebefore + // HRESULT SetSpaceBefore( [in] float Value ); + new void SetSpaceBefore(float Value); + + /// Retrieves the widow and orphan control state for the paragraphs in a range. + /// + /// Type: long* + /// A tomBool value that indicates the state of widow and orphan control. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Prevents the printing of a widow or orphan + /// + /// + /// + /// tomFalse + /// + /// Allows the printing of a widow or orphan. + /// + /// + /// + /// tomUndefined + /// + /// The widow-control property is undefined. + /// + /// + /// + /// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line of a paragraph is printed by itself at the bottom of a page. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getwidowcontrol + // HRESULT GetWidowControl( long *pValue ); + new tomConstants GetWidowControl(); + + /// Controls the suppression of widows and orphans. + /// + /// Type: long + /// A tomBool value that controls the suppression of widows and orphans. It can be one of the following possible values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// Prevents printing of widows and orphans. + /// + /// + /// + /// tomFalse + /// Allows printing of widows and orphans. + /// + /// + /// + /// tomToggle + /// The value is toggled. + /// + /// + /// + /// tomUndefined + /// No change. + /// + /// + /// + /// + /// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text. + /// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line of a paragraph is printed by itself at the bottom of a page. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setwidowcontrol + // HRESULT SetWidowControl( [in] long Value ); + new void SetWidowControl(tomConstants Value); + + /// Retrieves the tab count. + /// + /// Type: long* + /// The tab count. + /// + /// The tab count of a new instance can be nonzero, depending on the underlying text engine. For example, Microsoft Word stories begin with no explicit tabs defined, while rich edit instances start with a single explicit tab. To be sure there are no explicit tabs (that is, to set the tab count to zero), call ITextPara::ClearAllTabs. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettabcount + // HRESULT GetTabCount( long *pCount ); + new int GetTabCount(); + + /// Adds a tab at the displacement tbPos, with type tbAlign, and leader style, tbLeader. + /// + /// Type: float + /// New tab displacement, in floating-point points. + /// + /// + /// Type: long + /// Alignment options for the tab position. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomAlignLeft + /// + /// Text is left justified from the tab position. This is the default. + /// + /// + /// + /// tomAlignCenter + /// + /// Text is centered on the tab position. + /// + /// + /// + /// tomAlignRight + /// + /// Text is right justified from the tab position. + /// + /// + /// + /// tomAlignDecimal + /// + /// The decimal point is set at the tab position. This is useful for aligning a column of decimal numbers. + /// + /// + /// + /// tomAlignBar + /// + /// A vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form a continuous vertical line. + /// + /// + /// + /// + /// Type: long + /// Leader character style. A leader character is the character that is used to fill the space taken by a tab character. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomSpaces + /// + /// Spaces are used. This is the default. + /// + /// + /// + /// tomDots + /// + /// Dots are used. + /// + /// + /// + /// tomDashes + /// + /// A dashed line is used. + /// + /// + /// + /// tomLines + /// + /// A solid line is used. + /// + /// + /// + /// It is assumed that there is never a tab at position zero. If multiple paragraphs are described, the common subset of tabs will be returned with 0x8000 in the upper word of the tab type. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-addtab + // HRESULT AddTab( [in] float tbPos, [in] long tbAlign, [in] long tbLeader ); + new void AddTab(float tbPos, tomConstants tbAlign, tomConstants tbLeader); + + /// Clears all tabs, reverting to equally spaced tabs with the default tab spacing. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-clearalltabs + // HRESULT ClearAllTabs(); + new void ClearAllTabs(); + + /// Deletes a tab at a specified displacement. + /// + /// Type: float + /// Displacement, in floating-point points, at which a tab should be deleted. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-deletetab + // HRESULT DeleteTab( float tbPos ); + new void DeleteTab(float tbPos); + + /// Retrieves tab parameters (displacement, alignment, and leader style) for a specified tab. + /// + /// Type: long + /// Index of tab for which to retrieve info. It can be either a numerical index or a special value (see the following table). Since tab indexes are zero-based, iTab = zero gets the first tab defined, iTab = 1 gets the second tab defined, and so forth. The following table summarizes all of the possible values of iTab. + /// + /// + /// iTab + /// Value + /// Meaning + /// + /// + /// tomTabBack + /// –3 + /// Get tab previous to * ptbPos + /// + /// + /// tomTabNext + /// –2 + /// Get tab following * ptbPos + /// + /// + /// tomTabHere + /// –1 + /// Get tab at * ptbPos + /// + /// + /// + /// >= 0 + /// Get tab with index of iTab (and ignore ptbPos). + /// + /// + /// + /// + /// Type: float* + /// The tab displacement, in floating-point points. The value of * ptbPos is zero if the tab does not exist and the value of * ptbPos is tomUndefined if there are multiple values in the associated range. + /// + /// + /// Type: long* + /// The tab alignment. For more information, see ITextPara::AddTab. + /// + /// + /// Type: long* + /// The tab leader-character style. For more information, see ITextPara::AddTab. + /// + /// + /// Type: HRESULT + /// If ITextPara::GetTab succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes. For more information about COM error codes, see Error Handling in COM. + /// + /// + /// Return code + /// Description + /// + /// + /// Value + /// Meaning + /// + /// + /// E_INVALIDARG + /// Invalid argument. + /// + /// + /// CO_E_RELEASED + /// The paragraph formatting object is attached to a range that has been deleted. + /// + /// + /// S_FALSE + /// There is no tab corresponding to iTab. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettab + // HRESULT GetTab( long iTab, float *ptbPos, long *ptbAlign, long *ptbLeader ); + [PreserveSig] + new HRESULT GetTab(int iTab, out float ptbPos, out int ptbAlign, out int ptbLeader); + + /// + /// Not implemented. + /// Gets the borders collection. + /// + /// + /// Type: IUnknown** + /// The borders collection. /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getborders // HRESULT GetBorders( [out, retval] IUnknown **ppBorders ); [return: MarshalAs(UnmanagedType.IUnknown)] object GetBorders(); + /// Gets a duplicate of this text paragraph format object. + /// + /// Type: ITextPara2** + /// The duplicate text paragraph format object + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getduplicate2 + // HRESULT GetDuplicate2( [out, retval] ITextPara2 **ppPara ); ITextPara2 GetDuplicate2(); - HRESULT SetDuplicate2([In, Optional] ITextPara2? pPara); + /// Sets the properties of this object by copying the properties of another text paragraph object. + /// + /// Type: ITextPara2* + /// The text paragraph object to copy from. + /// + /// + /// tomUndefined values have no effect. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setduplicate2 + // HRESULT SetDuplicate2( [in] ITextPara2 *pPara ); + void SetDuplicate2([In, Optional] ITextPara2? pPara); - int GetFontAlignment(); + /// Gets the paragraph font alignment state. + /// + /// Type: long* + /// The paragraph font alignment state. It can be one of the following values. + /// + /// + /// Font Alignment States + /// + /// + /// tomFontAlignmentAuto (default) + /// + /// + /// tomFontAlignmentTop + /// + /// + /// tomFontAlignmentBaseline + /// + /// + /// tomFontAlignmentBottom + /// + /// + /// tomFontAlignmentCenter + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getfontalignment + // HRESULT GetFontAlignment( [out, retval] long *pValue ); + tomConstants GetFontAlignment(); - HRESULT SetFontAlignment(int Value); + /// Sets the paragraph font alignment for Chinese, Japanese, Korean text. + /// + /// Type: long + /// The paragraph font alignment. It can be one of the following values. + /// + /// + /// Font Alignment States + /// + /// + /// tomFontAlignmentAuto (default) + /// + /// + /// tomFontAlignmentTop + /// + /// + /// tomFontAlignmentBaseline + /// + /// + /// tomFontAlignmentBottom + /// + /// + /// tomFontAlignmentCenter + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setfontalignment + // HRESULT SetFontAlignment( [in] long Value ); + void SetFontAlignment(tomConstants Value); - int GetHangingPunctuation(); + /// Gets whether to hang punctuation symbols on the right margin when the paragraph is justified. + /// + /// Type: long* + /// A tomBool value that can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Hang punctuation symbols on the right margin. + /// + /// + /// + /// tomFalse + /// + /// Do not hang punctuation symbols on the right margin. + /// + /// + /// + /// tomUndefined + /// + /// The HangingPunctuation property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-gethangingpunctuation + // HRESULT GetHangingPunctuation( [out, retval] long *pValue ); + tomConstants GetHangingPunctuation(); - HRESULT SetHangingPunctuation(int Value); + /// Sets whether to hang punctuation symbols on the right margin when the paragraph is justified. + /// + /// Type: long + /// A tomBool value that can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Hang punctuation symbols on the right margin. + /// + /// + /// + /// tomFalse + /// + /// Do not hang punctuation symbols on the right margin. + /// + /// + /// + /// tomToggle + /// + /// Toggle the HangingPunctuation property. + /// + /// + /// + /// tomUndefined + /// + /// The HangingPunctuation property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-sethangingpunctuation + // HRESULT SetHangingPunctuation( [in] long Value ); + void SetHangingPunctuation(tomConstants Value); - int GetSnapToGrid(); + /// Gets whether paragraph lines snap to a vertical grid that could be defined for the whole document. + /// + /// Type: long* + /// A tomBool value that can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Paragraph lines snap to a vertical grid. + /// + /// + /// + /// tomFalse + /// + /// Paragraph lines do not snap to a grid. + /// + /// + /// + /// tomUndefined + /// + /// The SnapToGrid property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getsnaptogrid + // HRESULT GetSnapToGrid( [out, retval] long *pValue ); + tomConstants GetSnapToGrid(); - HRESULT SetSnapToGrid(int Value); + /// Sets whether paragraph lines snap to a vertical grid that could be defined for the whole document. + /// + /// Type: long + /// A tomBool value that can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Paragraph lines snap to a vertical grid. + /// + /// + /// + /// tomFalse + /// + /// Paragraph lines do not snap to a grid. + /// + /// + /// + /// tomToggle + /// + /// Toggle the SnapToGrid property. + /// + /// + /// + /// tomUndefined + /// + /// The SnapToGrid property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setsnaptogrid + // HRESULT SetSnapToGrid( [in] long Value ); + void SetSnapToGrid(tomConstants Value); - int GetTrimPunctuationAtStart(); + /// Gets whether to trim the leading space of a punctuation symbol at the start of a line. + /// + /// Type: long* + /// A tomBool value that can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Trim the leading space of a punctuation symbol at the start of a line. + /// + /// + /// + /// tomFalse + /// + /// Do not trim the leading space of a punctuation symbol at the start of a line. + /// + /// + /// + /// tomUndefined + /// + /// The TrimPunctuationAtStart property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-gettrimpunctuationatstart + // HRESULT GetTrimPunctuationAtStart( [out, retval] long *pValue ); + tomConstants GetTrimPunctuationAtStart(); - HRESULT SetTrimPunctuationAtStart(int Value); + /// Sets whether to trim the leading space of a punctuation symbol at the start of a line. + /// + /// Type: long + /// A tomBool that indicates whether to trim the leading space of a punctuation symbol. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomTrue + /// + /// Trim the leading space of a punctuation symbol at the start of a line. + /// + /// + /// + /// tomFalse + /// + /// Do not trim the leading space of a punctuation symbol at the start of a line. + /// + /// + /// + /// tomToggle + /// + /// Toggle the TrimPunctuationAtStart property. + /// + /// + /// + /// tomUndefined + /// + /// The TrimPunctuationAtStart property is undefined. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-settrimpunctuationatstart + // HRESULT SetTrimPunctuationAtStart( [in] long Value ); + void SetTrimPunctuationAtStart(tomConstants Value); - HRESULT GetEffects(out int pValue, out int pMask); + /// Gets the paragraph format effects. + /// + /// Type: long* + /// The paragraph effects. This value can be a combination of the following flags. + /// tomParaEffectRTL + /// tomParaEffectKeep + /// tomParaEffectKeepNext + /// tomParaEffectPageBreakBefore + /// tomParaEffectNoLineNumber + /// tomParaEffectNoWidowControl + /// tomParaEffectDoNotHyphen + /// tomParaEffectSideBySide + /// tomParaEffectCollapsed + /// tomParaEffectOutlineLevel + /// tomParaEffectBox + /// tomParaEffectTableRowDelimiter + /// tomParaEffectTable + /// + /// + /// Type: long* + /// The differences in the flags over the range. A value of 1 indicates that the corresponding effect is the same over the range. For an insertion point, the values equal 1 for all defined effects. + /// + /// If the tomTable flag is set, you can use the ITextRange2::GetTable method to get more table properties. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-geteffects + // HRESULT GetEffects( [out] long *pValue, [out] long *pMask ); + void GetEffects(out tomConstants pValue, out tomConstants pMask); - HRESULT GetProperty(int Type, out int pValue); + /// Gets the value of the specified property. + /// + /// Type: long + /// The ID of the property value to retrieve. + /// + /// + /// Type: long* + /// The property value. + /// + /// + /// The tomParaPropMathAlign property sets the math alignment for math paragraphs in a text paragraph. It can have one of the following values. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getproperty + // HRESULT GetProperty( [in] long Type, [out] long *pValue ); + tomConstants GetProperty(int Type); - HRESULT IsEqual2([In, Optional] ITextPara2? pPara, out int pB); + /// Determines whether this text paragraph object has the same properties as the specified text paragraph object. + /// + /// Type: ITextPara2* + /// The text paragraph object to compare against. + /// + /// + /// Type: long* + /// A tomBool value that is tomTrue if the text paragraph objects have the same properties, or tomFalse if they don't. This parameter can be NULL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-isequal2 + // HRESULT IsEqual2( [in] ITextPara2 *pPara, [out, retval] long *pB ); + tomConstants IsEqual2([In, Optional] ITextPara2? pPara); - HRESULT SetEffects(int Value, int Mask); + /// Sets the paragraph format effects. + /// + /// Type: long + /// The paragraph effects value. + /// This value can be a combination of the flags defined in the table for ITextPara2::GetEffects. + /// + /// + /// Type: long + /// The desired mask. + /// This value can be a combination of the flags defined in the table for ITextPara2::GetEffects. + /// Only effects with the corresponding mask flag set are modified. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-seteffects + // HRESULT SetEffects( [in] long Value, [in] long Mask ); + void SetEffects(tomConstants Value, tomConstants Mask); - HRESULT SetProperty(int Type, int Value); + /// Sets the property value. + /// + /// Type: long + /// The property ID of the property value to set. See ITextPara2::GetProperty for a list of defined properties. + /// + /// + /// Type: long + /// The property value to set. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setproperty + // HRESULT SetProperty( [in] long Type, [in] long Value ); + void SetProperty(int Type, int Value); } /// The ITextRange objects are powerful editing and data-binding tools that allow a program to select text in a story and then examine or change that text. @@ -8474,108 +10792,1280 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrange [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRange")] - [ComImport, Guid("8CC497C2-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("8CC497C2-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)] public interface ITextRange { - HRESULT GetText([MarshalAs(UnmanagedType.BStr)] out string pbstr); + /// Gets the plain text in this range. The Text property is the default property of the ITextRange interface. + /// + /// Type: BSTR* + /// The text. + /// + /// + /// The ITextRange::GetText method returns the plain text in the range. The Text property is the default property for ITextRange; this is, it is automatically invoked for a range, as in the following Microsoft Visual Basic for Applications (VBA) example. + /// Some of the examples below use this fact. The ITextRange::SetText method substitutes bstr for the range text. For processing a single character, the Char property is more efficient than the Text property and does not require creating a single character range for storing a character. If the range is degenerate, the Text property lets you insert text easily. You can also delete the text in a range, as shown in the following VBA examples. + /// You can use the Text property to copy plain text from one place to another, simply by setting one range equal to another. (This is quite different from the Duplicate property; for more information, see ITextRange::GetDuplicate). The following Microsoft Visual Basic example statement sets the text in the range1 to that in range2. + /// The ranges can be in different stories or even in different applications. However, they do imply copying the text first into a BSTR and then from that string to the target location. For large amounts of text, the ITextRange::Copy and ITextRange::Paste methods can be faster, since they can perform the copy directly from source to target and with any format supported by the source and target. + /// The text returned by the Text property is given in Unicode. The end-of-paragraph mark may be given by 0x2029 (the Unicode Paragraph Separator), or by carriage return/line feed (CR/LF) (0xd, 0xa), or by a carriage return alone, depending on the original file. Microsoft Word uses a carriage return alone, unless it reads another choice in from a file, the clipboard, or an IDataObject. The placeholder for an embedded object is given by the special character, WCH_EMBEDDING, which has the Unicode value 0xFFFC. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-gettext + // HRESULT GetText( BSTR *pbstr ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetText(); - HRESULT SetText([MarshalAs(UnmanagedType.BStr)] string bstr); + /// Sets the text in this range. + /// + /// Type: BSTR + /// Text that replaces the current text in this range. If null, the current text is deleted. + /// + /// + /// + /// ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed the text in. For UI selection behavior, see TypeText. + /// If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the ITextRange::SetText method (unless some other range has changed that text in between the calls). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-settext + // HRESULT SetText( [in] BSTR bstr ); + void SetText([MarshalAs(UnmanagedType.BStr)] string bstr); + /// Gets the character at the start position of the range. + /// + /// Type: long* + /// The start character position of the range. + /// + /// + /// The following Microsoft Visual Basic example sets ch equal to the character at the start of the range. + /// Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as bytes, words, variable-length, and so forth), and they do not require using a BSTR. + /// The Char property, which can do most things that a characters collection can, has two big advantages: + /// + /// + /// It can reference any character in the parent story instead of being limited to the parent range. + /// + /// + /// It is significantly faster, since LONGs are involved instead of range objects. + /// + /// + /// Accordingly, the Text Object Model (TOM) does not support a characters collection. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getchar + // HRESULT GetChar( long *pChar ); int GetChar(); - HRESULT SetChar(int Char); + /// Sets the character at the starting position of the range. + /// + /// Type: long + /// New value for character at the starting position. + /// + /// + /// + /// ITextRange::SetChar lets you specify the precise character code to use. However, string literals with similar looking glyphs can be misleading. + /// The characters set by this method are LONG instead of a BSTR. This hides the way that they are stored in the backing store, (as bytes, words, variable-length, and so forth). + /// Frequently on systems that do not have automatic word-wrapping, documents have hard carriage returns inserted just for line breaks. The following code shows a simple, but not perfect, way to convert such hard carriage returns back to blanks for the story that is associated with the range r. + /// Alternatively, you could use the following inside the IF loop. + /// This approach enables you to wrap the text to other widths. However, the algorithm isn't perfect: it assumes that a hard carriage return that is followed by anything other than white space (blank, tab, line feed, carriage return, and so forth) should be replaced by a blank. The algorithm also assumes that the carriage return character is a single character like carriage return or the Unicode end-of-paragraph (EOP) 0x2029 character. And, the combination carriage return and line feed isn't matched and would require writing and executing more code (or use ). Another caution is that there are other cases, such as mixed code and documentation, where the algorithm does not work correctly. + /// However, ITextRange::SetChar is more efficient than a replace operation that is accomplished by a delete followed by an insertion. Thus, rewriting the code without using ITextRange::SetChar would probably be much slower. + /// The Char property, which can do most things that a characters collection can, has two big advantages: it can reference any character in the parent story instead of being limited to the parent range, and it's significantly faster, since LONGs rather than range objects are involved. Because of these advantages, the Text Object Model (TOM) does not support a characters collection. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setchar + // HRESULT SetChar( long Char ); + void SetChar(int Char); + /// Gets a duplicate of this range object. + /// + /// Type: ITextRange** + /// The duplicate of the range. + /// + /// + /// To create an insertion point in order to traverse a range, first duplicate the range and then collapse the duplicate at its start character position. Note, a range is characterized by start and end character positions, and the story it belongs to. + /// Even if the range is actually an ITextSelection, the duplicate returned is an ITextRange. For an example, see the ITextRange::FindText method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getduplicate + // HRESULT GetDuplicate( ITextRange **ppRange ); ITextRange GetDuplicate(); + /// Gets an ITextRange object with the specified range's formatted text. + /// + /// Type: ITextRange** + /// The ITextRange object with the formatted text. + /// + /// + /// This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for Applications (VBA)-friendly. The method returns the formatted text in a range. If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface. + /// Among the formats typically supported by IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the FormattedText property to replace the text in a range2, by the formatted text in range1. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getformattedtext + // HRESULT GetFormattedText( ITextRange **ppRange ); ITextRange GetFormattedText(); - HRESULT SetFormattedText([In, Optional] ITextRange? pRange); + /// Sets the formatted text of this range text to the formatted text of the specified range. + /// + /// Type: ITextRange* + /// The formatted text to replace this range's text. + /// + /// + /// If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface. + /// Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the FormattedText property to replace the text in range2 with the formatted text in range1. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setformattedtext + // HRESULT SetFormattedText( [in] ITextRange *pRange ); + void SetFormattedText([In, Optional] ITextRange? pRange); + /// Gets the start character position of the range. + /// + /// Type: long* + /// The start character position. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstart + // HRESULT GetStart( long *pcpFirst ); int GetStart(); - HRESULT SetStart(int cpFirst); + /// Sets the character position for the start of this range. + /// + /// Type: long + /// The new character position for the start of the range. + /// + /// + /// Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst, making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled into view if the display isn't frozen. + /// ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following example shows how to convert a nondegenerate range into a degenerate one (insertion point). + /// Similarly, converts the range into an insertion point at the end position. + /// The following example adds 1 to the end position, if it is not at the end of the story. + /// This also makes the end position the active end of the range, and it can turn a degenerate range into a nondegenerate one. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setstart + // HRESULT SetStart( [in] long cpFirst ); + void SetStart(int cpFirst); + /// Gets the end character position of the range. + /// + /// Type: long* + /// The end character position. + /// + /// + /// Although a pointer to a range remains valid when the text is edited, this is not the case for the character position. A character position is volatile; that is, it becomes invalid as soon as text is inserted or deleted before the character position. Be careful about using methods that return character position values, especially if the values are to be stored for any duration. + /// This method is similar to the ITextRange::GetStart method which gets the start character position of the range. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getend + // HRESULT GetEnd( long *pcpLim ); int GetEnd(); - HRESULT SetEnd(int cpLim); + /// Sets the end position of the range. + /// + /// Type: long + /// The new end position. + /// + /// + /// If the new end position is less than the start position, this method also sets the start position to cp; that is, the range becomes an insertion point. + /// If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is scrolled into view. + /// ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a nondegenerate range, r, into a degenerate one (insertion point) at the start position, use + /// Similarly, r.Start = r.End converts r into an insertion point at the end position. + /// To add 1 to the end position, unless it is at the end of the story, use: + /// This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setend + // HRESULT SetEnd( long cpLim ); + void SetEnd(int cpLim); + /// Gets an ITextFont object with the character attributes of the specified range. + /// + /// Type: ITextFont** + /// The pointer to an ITextFont object. + /// + /// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on ITextFont for further details. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getfont + // HRESULT GetFont( ITextFont **ppFont ); ITextFont GetFont(); - HRESULT SetFont([In, Optional] ITextFont? pFont); + /// Sets this range's character attributes to those of the specified ITextFont object. + /// + /// Type: ITextFont* + /// A font object with the desired character format. + /// + /// + /// For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting + /// changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold + /// = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times. + /// Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it + /// values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setfont + // HRESULT SetFont( [in] ITextFont *pFont ); + void SetFont([In, Optional] ITextFont? pFont); + /// Gets an ITextPara object with the paragraph attributes of the specified range. + /// + /// Type: ITextPara** + /// The pointer to the ITextPara object. + /// + /// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on ITextPara for further details. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpara + // HRESULT GetPara( ITextPara **ppPara ); ITextPara GetPara(); - HRESULT SetPara([In, Optional] ITextPara? pPara); + /// Sets the paragraph attributes of this range to those of the specified ITextPara object. + /// + /// Type: ITextPara* + /// The paragraph object with the desired paragraph format. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpara + // HRESULT SetPara( [in] ITextPara *pPara ); + void SetPara([In, Optional] ITextPara? pPara); + /// Gets the count of characters in the range's story. + /// + /// Type: long* + /// The count of characters in the range's story. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorylength + // HRESULT GetStoryLength( long *pCount ); int GetStoryLength(); - int GetStoryType(); + /// Get the type of the range's story. + /// + /// Type: long* + /// The type of the range's story. The pValue value can be one of the following values. + /// + /// + /// Story type + /// Value + /// Story type + /// Value + /// + /// + /// + /// tomUnknownStory + /// + /// 0 + /// + /// tomEvenPagesHeaderStory + /// + /// 6 + /// + /// + /// + /// tomMainTextStory + /// + /// 1 + /// + /// tomPrimaryHeaderStory + /// + /// 7 + /// + /// + /// + /// tomFootnotesStory + /// + /// 2 + /// + /// tomEvenPagesFooterStory + /// + /// 8 + /// + /// + /// + /// tomEndnotesStory + /// + /// 3 + /// + /// tomPrimaryFooterStory + /// + /// 9 + /// + /// + /// + /// tomCommentsStory + /// + /// 4 + /// + /// tomFirstPageHeaderStory + /// + /// 10 + /// + /// + /// + /// tomTextFrameStory + /// + /// 5 + /// + /// tomFirstPageFooterStory + /// + /// 11 + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorytype + // HRESULT GetStoryType( long *pValue ); + tomConstants GetStoryType(); - HRESULT Collapse(int bStart); + /// Collapses the specified text range into a degenerate point at either the beginning or end of the range. + /// + /// Type: long + /// Flag specifying the end to collapse at. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomStart or tomTrue + /// + /// Range is collapsed to the start of the range. This is the default. + /// + /// + /// + /// tomEnd or tomFalse + /// + /// Range is collapsed to the end of the range. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-collapse + // HRESULT Collapse( [in] long bStart ); + void Collapse(tomConstants bStart); - HRESULT Expand(int Unit, out int pDelta); + /// Expands this range so that any partial units it contains are completely contained. + /// + /// Type: long + /// Unit to include, if it is partially within the range. The default value is . For a list of the other Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long* + /// The count of characters added to the range. The value can be null. + /// + /// For example, if an insertion point is at the beginning, the end, or within a word, ITextRange::Expand expands the range to include that word. If the range already includes one word and part of another, ITextRange::Expand expands the range to include both words. ITextRange::Expand expands the range to include the visible portion of the range's story. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-expand + // HRESULT Expand( long Unit, long *pDelta ); + int Expand(int Unit); - HRESULT GetIndex(int Unit, out int pIndex); + /// Retrieves the story index of the Unit parameter at the specified range Start character position. The first Unit in a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately preceding the Unit up to the last character in the Unit. + /// + /// Type: long + /// Unit that is indexed. For a list of possible Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long* + /// The index value. The value is zero if Unit does not exist. + /// + /// + /// The ITextRange::GetIndex method retrieves the story index of a word, line, sentence, paragraph, and so forth, at the range Start. Unit specifies which kind of entity to index, such as words (tomWord), lines (tomLine), sentences (tomSentence), or paragraphs (tomParagraph). For example, ITextRange::GetIndex sets pIndex equal to the line number of the first line in the range. For a range at the end of the story, ITextRange::GetIndex, returns the number of Units in the story. Thus, you can get the number of words, lines, objects, and so forth, in a story. + /// The index value returned by the ITextRange::GetIndex method is not valid if the text is subsequently edited. Thus, users should be careful about using methods that return index values, especially if the values are to be stored for any duration. This is in contrast to a pointer to a range, which does remain valid when the text is edited. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getindex + // HRESULT GetIndex( long Unit, long *pIndex ); + int GetIndex(int Unit); - HRESULT SetIndex(int Unit, int Index, int Extend); + /// Changes this range to the specified unit of the story. + /// + /// Type: long + /// Unit used to index the range. For a list of unit values, see ITextRange. + /// + /// + /// Type: long + /// Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of Units begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in the story corresponds to an Index of -1. + /// + /// + /// Type: long + /// Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start position of the specified Unit. If nonzero, the range is set to the entire Unit. + /// + /// This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, converts a range to an insertion point at the start of the tenth line. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setindex + // HRESULT SetIndex( [in] long Unit, [in] long Index, [in] long Extend ); + void SetIndex(int Unit, int Index, int Extend); - HRESULT SetRange(int cpAnchor, int cpActive); + /// Adjusts the range endpoints to the specified values. + /// + /// Type: long + /// The character position for the anchor end of the range. + /// + /// + /// Type: long + /// The character position for the active end of the range. + /// + /// + /// This method sets the range's start position to , and the end position to . If the range is a nondegenerate selection, cpAnchor is the active end, and cpAnchor is the anchor end. If the range is a degenerate selection, the selection is displayed at the start of the line, rather than at the end of the previous line. + /// This method removes any other subranges this range may have. To preserve the current subranges, use ITextRange2::SetActiveSubrange. + /// If the text range is a selection, you can set the attributes of the selection by using the ITextSelection::SetFlags method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setrange + // HRESULT SetRange( long cpAnchor, long cpActive ); + void SetRange(int cpAnchor, int cpActive); - HRESULT InRange([In, Optional] ITextRange? pRange, out int pValue); + /// Determines whether this range is within or at the same text as a specified range. + /// + /// Type: ITextRange* + /// Text that is compared to the current range. + /// + /// + /// Type: long* + /// The comparison result. The pointer can be null. The method returns pB is tomTrue only if the range is in or at the same text as pRange. + /// + /// + /// For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the following statements. + /// + /// + /// The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical insertion points. + /// + /// + /// Range2 is a nondegenerate range with start and end character positions at or within those of range1. + /// + /// + /// The following example shows how to walk one range with another. + /// When the ITextRange::FindText, ITextRange::MoveWhile, and ITextRange::MoveUntil method families are used, you can use one range to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in ITextRange::Find). + /// ITextRange::IsEqual is a special case of ITextRange::InRange that returns pBtomTrue if the pRange has the same start and end character positions and belongs to the same story. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-inrange + // HRESULT InRange( ITextRange *pRange, long *pValue ); + tomConstants InRange([In, Optional] ITextRange? pRange); - HRESULT InStory([In, Optional] ITextRange? pRange, out int pValue); + /// Determines whether this range's story is the same as a specified range's story. + /// + /// Type: ITextRange* + /// The ITextRange object whose story is compared to this range's story. + /// + /// + /// Type: long* + /// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range's story is the same as that of the pRange; otherwise it receives tomFalse. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-instory + // HRESULT InStory( ITextRange *pRange, long *pValue ); + tomConstants InStory([In, Optional] ITextRange? pRange); - HRESULT IsEqual([In, Optional] ITextRange? pRange, out int pValue); + /// Determines whether this range has the same character positions and story as those of a specified range. + /// + /// Type: ITextRange* + /// The ITextRange object that is compared to this range. + /// + /// + /// Type: long* + /// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range points at the same text (has the same start and end character positions and story) as pRange; otherwise it returns tomFalse. + /// + /// The ITextRange::IsEqual method returns tomTrue only if the range points at the same text as pRange. See Finding Rich Text for code that compares two different pieces of text to see if they contain the same plain text and the same character formatting. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-isequal + // HRESULT IsEqual( ITextRange *pRange, long *pValue ); + tomConstants IsEqual([In, Optional] ITextRange? pRange); - HRESULT Select(); + /// Sets the start and end positions, and story values of the active selection, to those of this range. + /// + /// The active end of the new selection is at the end position. + /// The caret for an ambiguous character position is displayed at the beginning of the line. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-select + // HRESULT Select(); + void Select(); - HRESULT StartOf(int Unit, int Extend, out int pDelta); + /// Moves the range ends to the start of the first overlapping Unit in the range. + /// + /// Type: long + /// Unit to use in the move operation. For a list of Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long + /// How to move the ends of the range. It can be one of the following values. + /// + /// + /// 0 (or tomMove) + /// Collapses a nondegenerate range to the start position by moving the insertion point. This is the default. + /// + /// + /// 1 (or tomExtend) + /// Moves the start position to the beginning of the overlapping Unit. Does not move the end position. + /// + /// + /// + /// + /// Type: long* + /// Pointer to a variable that receives the number of characters that the start position is moved. It can be null. On return, pDelta is the signed number of characters that the insertion point or start position is moved. This value is always less than or equal to zero, because the motion is always toward the beginning of the story. + /// + /// + /// If the range is an insertion point on a boundary between Units, ITextRange::StartOf does not change the start position. + /// The ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend from the active end, whereas ITextRange::StartOf extends from the start position and ITextRange::EndOf extends from the end position. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-startof + // HRESULT StartOf( long Unit, long Extend, long *pDelta ); + tomConstants StartOf(tomConstants Unit, tomConstants Extend); - HRESULT EndOf(int Unit, int Extend, out int pDelta); + /// Moves this range's ends to the end of the last overlapping Unit in the range. + /// + /// Type: long + /// Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long + /// Indicator of how the shifting of the range ends is to proceed. It can be one of the following. + /// + /// + /// 0 or tomMove + /// Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default. + /// + /// + /// 1 (or tomExtend) + /// Moves End to the end of the overlapping Unit. Does not move Start. + /// + /// + /// + /// + /// Type: long* + /// The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to –1, to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the final CR). + /// + /// For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf extends from End. If the range is an insertion point on a boundary between Units, ITextRange::EndOf does not change End. In particular, calling ITextRange::EndOf (tomCharacter, *, *) does not change End except for an insertion point at the beginning of a story. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-endof + // HRESULT EndOf( long Unit, long Extend, long *pDelta ); + tomConstants EndOf(tomConstants Unit, tomConstants Extend); - HRESULT Move(int Unit, int Count, out int pDelta); + /// Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed to an insertion point at either end, depending on Count, and then is moved. + /// + /// Type: long + /// Unit to use. The default value is tomCharacter. For information on other values, see the discussion in ITextRange. + /// + /// + /// Type: long + /// Number of Units to move past. The default value is 1. If Count is greater than zero, motion is forward—toward the end of the story—and if Count is less than zero, motion is backward—toward the beginning. If Count is zero, the range is unchanged. + /// + /// + /// Type: long* + /// The actual number of Units the insertion point moves past. The pointer can be NULL. For more information, see the Remarks section. + /// + /// + /// If the range is degenerate (an insertion point), this method tries to move the insertion point Count Units. + /// If the range is nondegenerate and Count is greater than zero, this method collapses the range at the end character position, moves the resulting insertion point forward to a Unit boundary (if it is not already at one), and then tries to move Count - 1 Units forward. If the range is nondegenerate and Count is less than zero, this method collapses the range at the start character position, moves the resulting insertion point backward to a Unit boundary (if it isn't already at one), and then tries to move |Count| - 1 Units backward. Thus, in both cases, collapsing a nondegenerate range to an insertion point, whether moving to the start or end of the Unit following the collapse, counts as a Unit. + /// The ITextRange::Move method returns pDelta = number of Units actually moved. This method never moves the insertion point beyond the story of this range. If CountUnits would move the insertion point before the beginning of the story, it is moved to the story beginning and pDelta is set accordingly. Similarly, if Count Units would move it beyond the end of the story, it is moved to the story end. + /// The ITextRange::Move method works similarly to the UI-oriented MoveLeft and MoveRight methods, except that the direction of motion is logical rather than geometrical. That is, with ITextRange::Move the direction is either toward the end or toward the start of the story. Depending on the language, moving toward the end of the story could be moving to the left or to the right. To get a feel for Count, press Ctrl+Right Arrow in a Microsoft Word document for a variety of selections. In left-to-right text, this keystroke behaves the same as , and . Count corresponds to the number of times you press Ctrl+Right Arrow. + /// For example, if you press Ctrl+Right Arrow for the selections shown in both of the following figures, you end up with an insertion point at character position 8, since this command collapses the selections at their end character positions (7 and 8, respectively) and moves to the next tomWord boundary. + /// The first selection does not include the blank space at character position 7, so Ctrl+Right Arrow moves past the space to the tomWord boundary at character position 8. The end character position is already at a tomWord boundary for the second selection, so Ctrl+Right Arrow just collapses the selection at that boundary. Similarly, Ctrl+Left Arrow, which for this text acts like , and collapses the first selection at character position 5, which is already at a tomWord boundary, so no more motion occurs. But Ctrl+Left Arrow collapses the second selection at character position 4 and then moves to zero, since that's the next tomWord boundary in the direction of motion. + /// The return argument, pDelta, is set equal to the number of Units that the insertion point is moved including one Unit for collapsing a nondegenerate range and moving it to a Unit boundary. So, if no motion and no collapse occur, as when the range is an insertion point at the end of the story, pDelta is set equal to zero. This approach is useful for controlling program loops that process a whole story. + /// In both of the cases mentioned above, calling sets pDelta equal to 1 because the ranges were collapsed. Similarly, calling sets pDelta equal to -1 for both cases. Collapsing, with or without moving part of a Unit to a Unit boundary, counts as a Unit moved. + /// The direction of motion refers to the logical character ordering in the plain-text backing store. This approach avoids the problems of geometrical ordering, such as left versus right and up versus down, in international software. Such geometrical methods are still needed in the edit engine, of course, since keyboards have arrow keys to invoke them. If the range is really an ITextSelection object, then methods like MoveLeft and MoveRight can be used. + /// If Unit specifies characters (tomCharacter), the Text Object Model (TOM) uses the Unicode character set. To convert between Unicode and multibyte character sets the MultiByteToWideChar and WideCharToMultiByte functions provide easy ways to convert between Unicode and multibyte character sets on import and export, respectively. For more information, see Open. In this connection, the use of a carriage return/line feed (CR/LF) to separate paragraphs is as problematic as double-byte character set (DBCS). The ITextSelection UI methods back up over a CR/LF as if it were a single character, but the ITextRange::Move methods count CR/LFs as two characters. It's clearly better to use a single character as a paragraph separator, which in TOM is represented by a character return, although the Unicode paragraph separator character, 0x2029, is accepted. In general, TOM engines should support CR/LF, carriage return (CR), line feed (LF), vertical tab, form feed, and 0x2029. Microsoft Rich Edit 2.0 also supports CR/CR/LF for backward compatibility. + /// See also the ITextRange::MoveStart and ITextRange::MoveEnd methods, which move the range Start or End position Count Units, respectively. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-move + // HRESULT Move( long Unit, long Count, long *pDelta ); + tomConstants Move(tomConstants Unit, int Count); - HRESULT MoveStart(int Unit, int Count, out int pDelta); + /// Moves the start position of the range the specified number of units in the specified direction. + /// + /// Type: long + /// Unit used in the move. The default value is tomCharacter. For a list of the other Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long + /// Number of units to move. The default value is 1. If Count is greater than zero, motion is forward—toward the end of the story—and if Count is less than zero, motion is backward—toward the beginning. If Count is zero, the start position is unchanged. + /// + /// + /// Type: long* + /// The actual number of units that the end is moved. The value can be null. + /// + /// + /// If the new start follows the old end, the new end is set equal to the new start. + /// The motion described by ITextRange::MoveStart is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestart + // HRESULT MoveStart( long Unit, long Count, long *pDelta ); + tomConstants MoveStart(tomConstants Unit, int Count); - HRESULT MoveEnd(int Unit, int Count, out int pDelta); + /// Moves the end position of the range. + /// + /// Type: long + /// The units by which to move the end of the range. The default value is tomCharacter. For a list of the other unit values, see ITextRange. + /// + /// + /// Type: long + /// The number of units to move past. The default value is 1. If Count is greater than zero, motion is forward—toward the end of the story—and if Count is less than zero, motion is backward—toward the beginning. If Count is zero, the end position is unchanged. + /// + /// + /// Type: long* + /// The actual number of units that the end position of the range is moved past. The value can be null. + /// + /// + /// If the new end position precedes the old start position, the new start position is set equal to the new end position; that is, it becomes a degenerate range or an insertion point. + /// The motion described by ITextRange::MoveEnd is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveend + // HRESULT MoveEnd( long Unit, long Count, long *pDelta ); + tomConstants MoveEnd(tomConstants Unit, int Count); - HRESULT MoveWhile([In] object Cset, int Count, out int pDelta); + /// Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching character is found. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is less than zero, the search starts at the start position and goes backward — toward the beginning of the story. If Count is greater than zero, the search starts at the end position and goes forward — toward the end of the story. + /// + /// + /// Type: long* + /// The actual count of characters end is moved. This parameter can be null. + /// + /// + /// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move. + /// The ITextRange::MoveWhile method is similar to ITextRange::MoveUntil, but MoveWhile searches as long as it finds members of the set specified by Cset, and there is no additional increment to the value pDelta. + /// The ITextRange::MoveStartWhile and ITextRange::MoveEndWhile methods move the start and end, respectively, just past all contiguous characters that are found in set of characters specified by the Cset parameter. + /// The VARIANT type is primarily intended to be used with IDispatch scenarios like Microsoft Visual Basic for Applications (VBA), but it can be readily used from C or C++ as well. The following C++ code illustrates how to initialize and use the VARIANT argument for matching a span of digits in the range r. + /// Alternatively, an explicit string could be used, as in the following sample. + /// The following VBA example code matches the body of the next Standard Generalized Markup Language (SGML) entry in a range, r. SGML entries start with < > and end with </ >. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movewhile + // HRESULT MoveWhile( VARIANT *Cset, long Count, long *pDelta ); + int MoveWhile([In] object Cset, int Count); - HRESULT MoveStartWhile([In] object Cset, int Count, out int pDelta); + /// Moves the start position of the range either Count characters, or just past all contiguous characters that are found in the set of characters specified by Cset, whichever is less. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search is forward—toward the end of the story—and if Count is less than zero, search is backward—toward the beginning. If Count is zero, the start position is unchanged. + /// + /// + /// Type: long* + /// The actual count of characters that the start position is moved. This parameter can be null. + /// + /// + /// If the new start follows the old end, the new end is set equal to the new start. + /// The motion described by ITextRange::MoveStartWhile is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartwhile + // HRESULT MoveStartWhile( VARIANT *Cset, long Count, long *pDelta ); + int MoveStartWhile([In] object Cset, int Count); - HRESULT MoveEndWhile([In] object Cset, int Count, out int pDelta); + /// Moves the end of the range either Count characters or just past all contiguous characters that are found in the set of characters specified by Cset, whichever is less. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged. + /// + /// + /// Type: long* + /// The actual number of characters that the end is moved. The value can be null. + /// + /// + /// If the new end precedes the old start, the new start is set equal to the new end. + /// The motion described by ITextRange::MoveEndWhile is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveendwhile + // HRESULT MoveEndWhile( VARIANT *Cset, long Count, long *pDelta ); + int MoveEndWhile([In] object Cset, int Count); - HRESULT MoveUntil([In] object Cset, int Count, out int pDelta); + /// Searches up to Count characters for the first character in the set of characters specified by Cset. If a character is found, the range is collapsed to that point. The start of the search and the direction are also specified by Count. + /// + /// Type: VARIANT* + /// The character set used in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is less than zero, the search is backward starting at the start position. If Count is greater than zero, the search is forward starting at the end. + /// + /// + /// Type: long* + /// The number of characters the insertion point is moved, plus 1 for a match if Count is greater than zero, and –1 for a match if Count less than zero. The pointer can be null. + /// + /// + /// If no character is matched, the range is unchanged. + /// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move. + /// The ITextRange::MoveStartUntil and ITextRange::MoveEndUntil methods move the start and end, respectively, until it finds the first character that is also in the set specified by the Cset parameter. + /// The ITextRange::MoveUntil method is similar to ITextRange::MoveWhile, but there are two differences. First, MoveUntil moves an insertion point until it finds the first character that belongs to the character set specified by Cset. Second, in MoveUntil the character matched counts as an additional character in the value returned in pDelta. This lets you know that the character at one end of the range or the other belongs to the Cset even though the insertion point stays at one of the range ends. + /// For example, suppose the range, r, is an insertion point. To see if the character at r (that is, given by r.GetChar()) is in Cset, call + /// If the character is in Cset, the return value is 1 and the insertion point does not move. Similarly, to see if the character preceding r is in Cset, call + /// If the character is in Cset, the return value is –1. + /// The following Microsoft Visual Basic for Applications (VBA) subroutine prints all numbers in the story identified by the range, r. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveuntil + // HRESULT MoveUntil( VARIANT *Cset, long Count, long *pDelta ); + int MoveUntil([In] object Cset, int Count); - HRESULT MoveStartUntil([In] object Cset, int Count, out int pDelta); + /// Moves the start position of the range the position of the first character found that is in the set of characters specified by Cset, provided that the character is found within Count characters of the start position. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search is forward—toward the end of the story—and if Count is less than zero, search is backward—toward the beginning. If Count is zero, the start position is unchanged. + /// + /// + /// Type: long* + /// The actual number of characters the start of the range is moved, plus 1 for a match if Count is greater than zero, and –1 for a match if Count is less than zero. The value can be null. + /// + /// + /// If no character from Cset is found within Count positions of the start position, the range is left unchanged. + /// If the new start follows the old end, the new end is set equal to the new start. + /// The motion described by ITextRange::MoveStartUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartuntil + // HRESULT MoveStartUntil( VARIANT *Cset, long Count, long *pDelta ); + int MoveStartUntil([In] object Cset, int Count); - HRESULT MoveEndUntil([In] object Cset, int Count, out int pDelta); + /// Moves the range's end to the character position of the first character found that is in the set of characters specified by Cset, provided that the character is found within Count characters of the range's end. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged. + /// + /// + /// Type: long* + /// The actual number of characters that the range end is moved, plus 1 for a match if Count is greater than zero, and –1 for a match if Count is less than zero. The value can be null. + /// + /// + /// If no character from the set specified by Cset is found within Count positions of the range's end, the range is left unchanged. If the new end precedes the old start, the new start is set equal to the new end. + /// The motion described by ITextRange::MoveEndUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveenduntil + // HRESULT MoveEndUntil( VARIANT *Cset, long Count, long *pDelta ); + int MoveEndUntil([In] object Cset, int Count); - HRESULT FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, int Flags, out int pLength); + /// Searches up to Count characters for the text given by bstr. The starting position and direction are also specified by Count, and the matching criteria are given by Flags. + /// + /// Type: BSTR + /// String to find. + /// + /// + /// Type: long + /// Maximum number of characters to search. It can be one of the following. + /// + /// + /// + /// tomForward + /// + /// Searches to the end of the story. This is the default value. + /// + /// + /// + /// n (greater than 0) + /// Searches forward for n chars, starting from cpFirst. If the range itself matches bstr, another search is attempted from cpFirst + 1. + /// + /// + /// + /// n(less than 0) + /// Searches backward for n chars, starting from cpLim. If the range itself matches bstr, another search is attempted from cpLim– 1. + /// + /// + /// 0 (degenerate range) + /// Search begins after the range. + /// + /// + /// 0 (nondegenerate range) + /// Search is limited to the range. + /// + /// + ///  + /// In all cases, if a string is found, the range limits are changed to be those of the matched string and pLength is set equal to the length of the string. If the string is not found, the range remains unchanged and pLength is set equal to zero. + /// + /// + /// Type: long + /// Flags governing comparisons. It can be 0 (the default) or any combination of the following values. + /// + /// + /// + /// tomMatchWord + /// + /// 2 + /// Matches whole words. + /// + /// + /// + /// tomMatchCase + /// + /// 4 + /// Matches case. + /// + /// + /// + /// tomMatchPattern + /// + /// 8 + /// Matches regular expressions. + /// + /// + /// + /// + /// Type: long* + /// The length of string matched. + /// + /// + /// The ITextRange::FindText method can also match special characters by using a caret (^) followed by a special letter. For a list of special characters, see the Special list available in the Microsoft Word Find and Replace dialog box. For example, matches the next paragraph mark. Note, can be used to represent the Clipboard contents in the string to be replaced. Thus, using in the find string enables you to search for rich text. For more details, see the Word Help files. + /// As a comparison with the ITextRange::FindText method, the ITextRange::FindTextStart method searches forward or backward from the range's Start cp, and the ITextRange::FindTextEnd method searches forward or backward from the range's End cp. For more details, see the descriptions of these methods. + /// The following are several code snippets that show the ITextRange::FindText methods. + /// Example #1. The following Microsoft Visual Basic for Applications (VBA) program prints all the /* ... */ comments in a story identified by the range r. + /// Instead of these comments being printed, they could be inserted into another edit instance and saved to a file, or they could be inserted into separate cells in a table or spreadsheet. + /// To print all lines containing one or more occurrences of the word "laser", replace the loop by the following code: + /// Example #2. The following program prints a telephone list, given a story that contains an address list. The address list entries are separated by two or more paragraph marks, and each entry has the following form. + /// Note the use of the character in the FindText string argument to locate a pair of consecutive paragraph marks. + /// Example #3. The following subroutine replaces all occurrences of the string, str1, in a range by str2: + /// Example #4. The following line of code inserts a blank before the first occurrence of a right parenthesis, "(", that follows an occurrence of HRESULT. + /// To do this for all such occurrences, change the If into a While/Wend loop in the above line of code. This an example of a FIND/REPLACE macro that cannot be run with Find and Replace dialog boxes. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtext + // HRESULT FindText( BSTR bstr, long Count, long Flags, long *pLength ); + int FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags); - HRESULT FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, int Flags, out int pLength); + /// Searches up to Count characters for the string, bstr, starting at the range's Start cp (cpFirst). The search is subject to the comparison parameter, Flags. If the string is found, the Start cp is changed to the matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged, and pLength is set equal to zero. + /// + /// Type: BSTR + /// The string to search for. + /// + /// + /// Type: long + /// Maximum number of characters to search. It can be one of the following. + /// + /// + /// + /// tomForward + /// + /// Search to the end of the story. This is the default value. + /// + /// + /// + /// n (greater than 0) + /// Search forward for n chars, starting from cpLim. + /// + /// + /// + /// n (less than 0) + /// Search backward for n chars, starting from cpLim. + /// + /// + /// + /// + /// Type: long + /// Flags governing the comparisons. It can be zero (the default) or any combination of the following values. + /// + /// + /// + /// tomMatchWord + /// + /// 2 + /// Matches whole words. + /// + /// + /// + /// tomMatchCase + /// + /// 4 + /// Matches case. + /// + /// + /// + /// tomMatchPattern + /// + /// 8 + /// Matches regular expressions. + /// + /// + /// + /// + /// Type: long* + /// The length of the matched string. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextstart + // HRESULT FindTextStart( BSTR bstr, long Count, long Flags, long *pLength ); + int FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags); - HRESULT FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, int Flags, out int pLength); + /// Searches up to Count characters for the string, bstr, starting from the range's End cp. The search is subject to the comparison parameter, Flags. If the string is found, the End cp is changed to be the end of the matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged and pLength is set equal to zero. + /// + /// Type: BSTR + /// String to search for. + /// + /// + /// Type: long + /// Maximum number of characters to search. It can be one of the following. + /// + /// + /// + /// tomForward + /// + /// Search to the end of the story. This is the default value. + /// + /// + /// + /// n (greater than 0) + /// Search forward for n chars, starting from cpLim. + /// + /// + /// + /// n (less than 0) + /// Search backward for n chars, starting from cpLim. + /// + /// + /// + /// + /// Type: long + /// Flags governing comparisons. It can be zero (the default) or any combination of the following values. + /// + /// + /// + /// tomMatchWord + /// + /// 2 + /// Matches whole words. + /// + /// + /// + /// tomMatchCase + /// + /// 4 + /// Matches case. + /// + /// + /// + /// tomMatchPattern + /// + /// 8 + /// Matches regular expressions. + /// + /// + /// + /// + /// Type: long* + /// The length of string matched. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextend + // HRESULT FindTextEnd( BSTR bstr, long Count, long Flags, long *pLength ); + int FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags); - HRESULT Delete(int Unit, int Count, out int pDelta); + /// Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed. + /// + /// Type: long + /// Unit to use. Unit can be tomCharacter (the default value) or tomWord. + /// + /// + /// Type: long + /// Number of Units to delete. If Count= zero, it deletes the text in the range only. If Count is greater than zero, ITextRange::Delete acts as if the DELETE key was pressed Count times. If Count is less than zero, it acts as if the BACKSPACE key was pressed Count times. The default value is 1. For more information, see the Remarks. + /// + /// + /// Type: long* + /// The count of units deleted. It can be null. The pDelta parameter is set equal to the number of Units deleted. Deleting the text in a nondegenerate range counts as one Unit. + /// + /// + /// If Count = zero, this method deletes the text in the range, that is, it deletes nothing if the range is only an insertion point. + /// If Count is not zero, and the range is an insertion point (that is, degenerate), | Count| (absolute value of Count) Units are deleted in the logical direction given by the sign of Count, where a positive value is the direction toward the end of the story, and a negative value is toward the start of the story. + /// If Count is not zero, and the range is nondegenerate (contains text), the text in the range is deleted (regardless of the values of Unit and Count), thereby creating an insertion point. Then, | Count| - 1  Units are deleted in the logical direction given by the sign of Count. + /// The text in the range can also be deleted by assigning a null string to the range (executing statement r = where r is the range). However, ITextRange::Delete does not require allocating a BSTR. + /// Deleting the end-of-paragraph mark (CR) results in the special behavior of the Microsoft Word UI. Four cases are of particular interest: + /// + /// + /// If you delete just the CR but the paragraph includes text, then the CR is deleted, and the following paragraph gets the same paragraph formatting as current one. + /// + /// + /// If you delete the CR as well as some, but not all, of the characters in the following paragraph, the characters left over from the current paragraph get the paragraph formatting of the following paragraph. + /// + /// + /// If you select to the end of a paragraph, but not the whole paragraph, the CR is not deleted. + /// + /// + /// If you delete the whole paragraph (from the beginning through the CR), you delete the CR as well (unless it is the final CR in the file). + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-delete + // HRESULT Delete( long Unit, long Count, long *pDelta ); + int Delete(tomConstants Unit, int Count); - HRESULT Cut(out VARIANT pVar); + /// Cuts the plain or rich text to a data object or to the Clipboard, depending on the pVar parameter. + /// + /// Type: VARIANT* + /// The cut text. pVar->ppunkVal is the out parameter for an IDataObject object, provided that the following conditions exist: + /// + /// + /// pVar->vt = (VT_UNKNOWN | VT_BYREF) + /// + /// + /// pVar is not null + /// + /// + /// pVar->ppunkVal is not null + /// + /// + /// Otherwise, the clipboard is used. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-cut + // HRESULT Cut( VARIANT *pVar ); + void Cut(out object pVar); - HRESULT Copy(out VARIANT pVar); + /// Copies the text to a data object. + /// + /// Type: VARIANT* + /// The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist: + /// + /// + /// pVar->vt = (VT_UNKNOWN | VT_BYREF) + /// + /// + /// pVar is not null + /// + /// + /// pVar->ppunkVal is not null + /// + /// + /// Otherwise, the clipboard is used. + /// + /// + /// The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy, and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to reference a text solution's own internal rich text formats. + /// To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example: + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-copy + // HRESULT Copy( VARIANT *pVar ); + void Copy(out object pVar); - HRESULT Paste([In] object pVar, int Format); + /// Pastes text from a specified data object. + /// + /// Type: VARIANT* + /// The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true. + /// pVar is null + /// pVar punkVal is null + /// pVar is not VT_UNKNOWN + /// pVar punkVal does not return an IDataObject when queried for one + /// + /// + /// Type: long + /// The clipboard format to use in the paste operation. Zero is best format, which usually is RTF, but CF_UNICODETEXT and other formats are also possible. The default value is zero. For more information, see Clipboard Formats. + /// + /// + /// Type: HRESULT + /// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Destination is write-protected. + /// + /// + /// E_OUTOFMEMORY + /// Destination cannot contain the text to be pasted. + /// + /// + /// + /// For more information, seeITextRange::Copy. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-paste + // HRESULT Paste( VARIANT *pVar, long Format ); + void Paste([In] object pVar, int Format); - HRESULT CanPaste([In] object pVar, int Format, out int pValue); + /// Determines if a data object can be pasted, using a specified format, into the current range. + /// + /// Type: VARIANT* + /// The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true: + /// + /// + /// + /// pVar is null + /// + /// + /// + /// pVar->punkVal is null + /// + /// + /// + /// pVar->vt is not VT_UNKNOWN + /// + /// + /// + /// pVar->punkVal does not return an IDataObject object when queried for one + /// + /// + /// + /// + /// Type: long + /// Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats are also possible. The default value is zero. + /// + /// + /// Type: long* + /// A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified format, into the range. This parameter can null. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canpaste + // HRESULT CanPaste( VARIANT *pVar, long Format, long *pValue ); + tomConstants CanPaste([In] object pVar, int Format); - HRESULT CanEdit(out int pValue); + /// Determines whether the specified range can be edited. + /// + /// Type: long* + /// A tomBool value indicating whether the range can be edited. It is tomTrue only if the specified range can be edited. The pointer can be null. + /// + /// The range cannot be edited if any part of it is protected or if the document is read-only. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canedit + // HRESULT CanEdit( [retval] long *pValue ); + tomConstants CanEdit(); - HRESULT ChangeCase(int Type); + /// Changes the case of letters in this range according to the Type parameter. + /// + /// Type: long + /// Type of case change. The default value is tomLower. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomLowerCase 0 + /// Sets all text to lowercase. + /// + /// + /// + /// tomUpperCase 1 + /// Sets all text to lowercase. + /// + /// + /// + /// tomTitleCase 2 + /// Capitalizes the first letter of each word. + /// + /// + /// + /// tomSentenceCase 4 + /// Capitalizes the first letter of each sentence. + /// + /// + /// + /// tomToggleCase 5 + /// Toggles the case of each letter. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-changecase + // HRESULT ChangeCase( [in] long Type ); + void ChangeCase(tomConstants Type); - HRESULT GetPoint(int Type, out int px, out int py); + /// Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position. + /// + /// Type: long + /// Flag that indicates the position to retrieve. This parameter can include one value from each of the following tables. The default value is tomStart + TA_BASELINE + TA_LEFT. + /// tomAllowOffClient + /// tomClientCoord + /// tomObjectArg + /// tomTransform + /// Use one of the following values to indicate the start or end of the range. + /// tomStart + /// tomEnd + /// Use one of the following values to indicate the vertical position. + /// + /// + /// TA_TOP + /// Top edge of the bounding rectangle. + /// + /// + /// TA_BASELINE + /// Base line of the text. + /// + /// + /// TA_BOTTOM + /// Bottom edge of the bounding rectangle. + /// + /// + /// Use one of the following values to indicate the horizontal position. + /// + /// + /// TA_LEFT + /// Left edge of the bounding rectangle. + /// + /// + /// TA_CENTER + /// Center of the bounding rectangle. + /// + /// + /// TA_RIGHT + /// Right edge of the bounding rectangle. + /// + /// + /// + /// + /// Type: long* + /// The x-coordinate. + /// + /// + /// Type: long* + /// The y-coordinate. + /// + /// The ITextRange::GetPoint method gives ITextRange the ability to emulate UI-pointer commands; it is also handy for accessibility purposes. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpoint + // HRESULT GetPoint( long Type, long *px, long *py ); + void GetPoint(int Type, out int px, out int py); - HRESULT SetPoint(int x, int y, int Type, int Extend); + /// Changes the range based on a specified point at or up through (depending on Extend) the point (x, y) aligned according to Type. + /// + /// Type: long + /// Horizontal coordinate of the specified point, in absolute screen coordinates. + /// + /// + /// Type: long + /// Vertical coordinate of the specified point, in absolute screen coordinates. + /// + /// + /// Type: long + /// The end to move to the specified point. It can be one of the following. + /// + /// + /// + /// tomStart + /// + /// Move the start of range. + /// + /// + /// + /// tomEnd + /// + /// Move the end of range. + /// + /// + /// + /// + /// Type: long + /// How to set the endpoints of the range. If Extend is zero (the default), the range is an insertion point at the specified point (or at the nearest point with selectable text). If Extend is 1, the end specified by Type is moved to the point and the other end is left alone. + /// + /// An application can use the specified point in the WindowFromPoint function to get the handle of the window, which usually can be used to find the client-rectangle coordinates (although a notable exception is with Windowless Controls). + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpoint + // HRESULT SetPoint( [in] long x, [in] long y, [in] long Type, [in] long Extend ); + void SetPoint(int x, int y, tomConstants Type, int Extend); - HRESULT ScrollIntoView(int Value); + /// Scrolls the specified range into view. + /// + /// Type: long + /// Flag specifying the end to scroll into view. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// tomEnd + /// Scrolls the end character position to appear on the bottom line. + /// + /// + /// tomStart + /// Scrolls the start character position to appear on the top line. (Default value). + /// + /// + /// tomNoUpScroll + /// + /// + /// + /// tomNoVpScroll + /// + /// + /// + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-scrollintoview + // HRESULT ScrollIntoView( long Value ); + [PreserveSig] + HRESULT ScrollIntoView(tomConstants Value); /// Retrieves a pointer to the embedded object at the start of the specified range, that is, at cpFirst. The range must either be an insertion point or it must select only the embedded object. /// @@ -8589,401 +12079,2343 @@ public static partial class MsftEdit object GetEmbeddedObject(); } - /// - /// Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara. - /// The ITextPara2 interface extends ITextPara, providing the equivalent of the Microsoft Word format-paragraph dialog. - /// - // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextpara2 - [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextPara2")] - [ComImport, Guid("C241F5E4-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] - public interface ITextPara2 : ITextPara - { - /// - /// Not implemented. - /// Gets the borders collection. - /// - /// - /// Type: IUnknown** - /// The borders collection. - /// - /// - /// Type: HRESULT - /// If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code. - /// - // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getborders - // HRESULT GetBorders( [out, retval] IUnknown **ppBorders ); - [return: MarshalAs(UnmanagedType.IUnknown)] - object GetBorders(); - - ITextPara2 GetDuplicate2(); - - HRESULT SetDuplicate2([In, Optional] ITextPara2? pPara); - - int GetFontAlignment(); - - HRESULT SetFontAlignment(int Value); - - int GetHangingPunctuation(); - - HRESULT SetHangingPunctuation(int Value); - - int GetSnapToGrid(); - - HRESULT SetSnapToGrid(int Value); - - int GetTrimPunctuationAtStart(); - - HRESULT SetTrimPunctuationAtStart(int Value); - - HRESULT GetEffects(out int pValue, out int pMask); - - HRESULT GetProperty(int Type, out int pValue); - - HRESULT IsEqual2([In, Optional] ITextPara2? pPara, out int pB); - - HRESULT SetEffects(int Value, int Mask); - - HRESULT SetProperty(int Type, int Value); - } - - /// The ITextRange objects are powerful editing and data-binding tools that allow a program to select text in a story and then examine or change that text. - /// - /// Multiple text ranges can be active and work cooperatively on the same story and evolve with the story. For example, if one text range deletes specified text before another text range, the latter tracks the change. In this sense, text ranges are similar to Microsoft Word bookmarks, which also track editing changes. However, bookmarks cannot edit text, while text ranges can. In addition, ranges let you manipulate text without changing the selection or Clipboard, both of which are valuable to end users. The ITextSelection interface inherits from ITextRange and adds some UI-oriented methods and properties as described in the section on ITextSelection. - /// You can look at a text range using methods based on character positions. Specifically, a text range is characterized by: - /// - /// - /// The first character position, cpFirst, which points at an insertion point immediately preceding the first character (relative to the beginning of the story) in the range. - /// - /// - /// The limit position, cpLim, which points at an insertion point immediately following the last character in the range. - /// - /// - /// The first character in a story has cpFirst = zero. If a cp argument has a value greater than the number of characters in the story, the number of characters in the story is used instead. If a cp argument is negative, zero is used instead. For those familiar with Microsoft Visual Basic for Applications, call the cpFirst property Start and the cpLim property End (even though the starting position of a range is also an end). - /// In the following figure, character positions are represented by the lines separating the letters. The corresponding character position values are given beneath the lines. The range starting at cpFirst = 5 and ending at cpLim = 7 contains the two-letter word is. If this figure depicts the complete text in a story, the story length is 30. - /// The length of a range is given by cpLim - cpFirst or equivalently by End - Start. A range with zero length is called a degenerate or empty range and has equal cp* values, that is, cpFirst = cpLim. An example of a degenerate range is the current insertion point. A non-null selection is an example of a nondegenerate range. - /// Suppose that the range from 5 to 7 indicated by shaded cells in the preceding figure is told to delete its text (see Delete), thereby turning itself into an insertion point. The range from 25 to 29 would automatically track its contents, namely the word text. The following figure shows the result. - /// In this figure, the range for text now has been automatically adjusted to have cpFirst = 23 and cpLim = 27. The owner of the range does not have to worry about updating the range character position values in the face of editing. - /// The names of the move methods indicate which end to move, but note that if any method attempts to move one range end past the other, both ends get moved to the target position. As a result, the insertion point is at the target position. The concept is that cpFirst and cpLim always have to obey the fundamental condition - /// 0 <= cpFirst <= cpLim <= # characters in story - /// or equivalently for a range r, 0 <= r.Start <= r.End <= r.StoryLength, which is what you would expect from the names of these quantities. - /// Another important feature is that all stories contain an undeletable final CR (0xD) character at the end. So even an empty story has a single character, namely the final CR. A range can select this character, but cannot become an insertion point beyond it. To see how this works, try selecting the final CR in a Word document and then press the RIGHT ARROW key to collapse it. The directory tree will collapse before the final CR, but the CR cannot be deleted. The Text Object Model (TOM) functions the same way. So, if r.Start <= r.End, then r.End <= (r.StoryLength – 1). For a discussion about deleting a CR, see Delete. - /// Some methods depend on a Unit argument, which can take on the predefined values listed in the following table. - /// - /// - /// Unit - /// Value - /// Meaning - /// - /// - /// tomCharacter - /// 1 - /// Character. - /// - /// - /// tomWord - /// 2 - /// Word. - /// - /// - /// tomSentence - /// 3 - /// Sentence. - /// - /// - /// tomParagraph - /// 4 - /// Paragraph. - /// - /// - /// tomLine - /// 5 - /// Line (on display). - /// - /// - /// tomStory - /// 6 - /// Story. - /// - /// - /// tomScreen - /// 7 - /// Screen (as for PAGE UP/PAGE DOWN). - /// - /// - /// tomSection - /// 8 - /// Section. - /// - /// - /// tomColumn - /// 9 - /// Table column. - /// - /// - /// tomRow - /// 10 - /// Table row. - /// - /// - /// tomWindow - /// 11 - /// Upper-left or lower-right of the window. - /// - /// - /// tomCell - /// 12 - /// Table cell. - /// - /// - /// tomCharFormat - /// 13 - /// Run of constant character formatting. - /// - /// - /// tomParaFormat - /// 14 - /// Run of constant paragraph formatting. - /// - /// - /// tomTable - /// 15 - /// Table. - /// - /// - /// tomObject - /// 16 - /// Embedded object. - /// - /// - ///  - /// Most of the Unit values are self-explanatory. However the following descriptions are provided for additional clarity. - /// tomWord - /// The tomWord constant is an end of paragraph or a span of alphanumerics or punctuation including any blanks that follow. To get an on-screen feel for tomWord, watch how the caret moves when you press CTRL+RIGHT ARROW (—>) or CTRL+LEFT ARROW (<—) in a Word document. - /// tomSentence - /// The tomSentence constant describes a string of text that ends with a period, question mark, or exclamation mark and is followed either by one or more ASCII white space characters (9 through 0xd and 0x20), or the Unicode paragraph separator (0x2029). The trailing white space is part of the sentence. The last sentence in a story does not need to have a period, question mark, or exclamation mark. The start of a story qualifies as the start of a tomSentence, even if the string there does not qualify as a sentence grammatically. Other sentences must follow a sentence end and cannot begin with a period, question mark, or exclamation mark. - /// tomParagraph - /// The tomParagraph constant is a string of text terminated by an end-of-paragraph mark (CRLF, CR, VT (for SHIFT+ENTER), LF, FF, or 0x2029). TOM engines always have an undeletable end-of-paragraph mark at the end of a story. Thus, all TOM stories automatically have at least one tomWord, one tomSentence, and one tomParagraph. - /// tomLine - /// The tomLine constant corresponds to one line of text on a display, provided that a display is associated with the range. If no display is associated with a range, tomLine is treated as tomParagraph. A selection automatically has a display and a range that is a duplicate (see GetDuplicate). Other ranges may not have a display, depending on the TOM engine and context. - /// Methods that move one or both ends in terms of Unit, such as Move, MoveEnd, and MoveStart, depend on the signed Count argument. Except for the ITextSelection geometrical movement commands, if Count is greater than zero, the ends to be moved are moved forward (toward the end of the story), and if Count is less than zero, the ends are moved backward (toward the beginning). The default value of Count for these Move methods is 1. These methods attempt to move Count Units, but movement is never beyond the ends of the story. - /// Methods that move one or both ends by matching character strings or string patterns, such as MoveWhile, MoveEndWhile, and MoveStartWhile, can move up to a maximum number of characters given by the signed Count argument. If Count is greater than zero, the ends to be moved are moved forward, and if Count is less than zero, the ends are moved backward. Two special Count values, tomForward and tomBackward, are defined. These values are guaranteed to reach the end and the start of the story, respectively. The default value of Count is tomForward. - /// In Move* methods that turn a nondegenerate range into a degenerate one, such as Move, MoveWhile, and MoveUntil, cpFirst is changed if Count is negative and cpLim is changed if Count is positive. After this movement, the other end of the range is also moved to the new location. See the individual methods for more specific Count information. For nondegenerate ranges, the methods MoveStart, MoveEnd, MoveStartWhile, MoveEndWhile, MoveStartUntil and MoveEndUntil move either the starting position (Start) or the ending position (End). - /// To select a unit that corresponds to a contiguous range, such as a tomWord, tomSentence, and tomParagraph, use the MoveEnd method. To select a unit that corresponds to a noncontiguous range, such as tomObject, use the EndOf method, since the next object may occur after substantial intermediate text, if at all. To select a tomCell unit, the range must be inside a table. - /// Examples and further explanation of the Count and Unit arguments follow. Note that TOM engines may not support all of the units in the table above. For example, rich edit controls do not offer the concepts of sections, but rather return E_NOTIMPL when given tomSection. However if a TOM engine does support a unit, it has the index value given in the table. - /// Applications typically do not implement the ITextRange interface. Microsoft text solutions, such as rich edit controls, implement ITextRange as part of their TOM implementation. - /// Applications can retrieve an ITextRange pointer by calling the Range method. - /// - // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrange - [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRange")] - [ComImport, Guid("8CC497C2-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] - public interface ITextRange - { - HRESULT GetText([MarshalAs(UnmanagedType.BStr)] out string pbstr); - - HRESULT SetText([MarshalAs(UnmanagedType.BStr)] string bstr); - - int GetChar(); - - HRESULT SetChar(int Char); - - ITextRange GetDuplicate(); - - ITextRange GetFormattedText(); - - HRESULT SetFormattedText([In, Optional] ITextRange? pRange); - - int GetStart(); - - HRESULT SetStart(int cpFirst); - - int GetEnd(); - - HRESULT SetEnd(int cpLim); - - ITextFont GetFont(); - - HRESULT SetFont([In, Optional] ITextFont? pFont); - - ITextPara GetPara(); - - HRESULT SetPara([In, Optional] ITextPara? pPara); - - int GetStoryLength(); - - int GetStoryType(); - - HRESULT Collapse(int bStart); - - HRESULT Expand(int Unit, out int pDelta); - - HRESULT GetIndex(int Unit, out int pIndex); - - HRESULT SetIndex(int Unit, int Index, int Extend); - - HRESULT SetRange(int cpAnchor, int cpActive); - - HRESULT InRange([In, Optional] ITextRange? pRange, out int pValue); - - HRESULT InStory([In, Optional] ITextRange? pRange, out int pValue); - - HRESULT IsEqual([In, Optional] ITextRange? pRange, out int pValue); - - HRESULT Select(); - - HRESULT StartOf(int Unit, int Extend, out int pDelta); - - HRESULT EndOf(int Unit, int Extend, out int pDelta); - - HRESULT Move(int Unit, int Count, out int pDelta); - - HRESULT MoveStart(int Unit, int Count, out int pDelta); - - HRESULT MoveEnd(int Unit, int Count, out int pDelta); - - HRESULT MoveWhile([In] object Cset, int Count, out int pDelta); - - HRESULT MoveStartWhile([In] object Cset, int Count, out int pDelta); - - HRESULT MoveEndWhile([In] object Cset, int Count, out int pDelta); - - HRESULT MoveUntil([In] object Cset, int Count, out int pDelta); - - HRESULT MoveStartUntil([In] object Cset, int Count, out int pDelta); - - HRESULT MoveEndUntil([In] object Cset, int Count, out int pDelta); - - HRESULT FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, int Flags, out int pLength); - - HRESULT FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, int Flags, out int pLength); - - HRESULT FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, int Flags, out int pLength); - - HRESULT Delete(int Unit, int Count, out int pDelta); - - HRESULT Cut(out VARIANT pVar); - - HRESULT Copy(out VARIANT pVar); - - HRESULT Paste([In] object pVar, int Format); - - HRESULT CanPaste([In] object pVar, int Format, out int pValue); - - HRESULT CanEdit(out int pValue); - - HRESULT ChangeCase(int Type); - - HRESULT GetPoint(int Type, out int px, out int py); - - HRESULT SetPoint(int x, int y, int Type, int Extend); - - HRESULT ScrollIntoView(int Value); - - [return: MarshalAs(UnmanagedType.IUnknown)] - object GetEmbeddedObject(); - } - /// The ITextRange2 interface is derived from ITextRange, and its objects are powerful editing and data-binding tools that enable a program to select text in a story and then examine or change that text. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrange2 [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRange2")] - [ComImport, Guid("C241F5E2-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5E2-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextRange2 : ITextSelection { - int GetCch(); + /// Gets the plain text in this range. The Text property is the default property of the ITextRange interface. + /// + /// Type: BSTR* + /// The text. + /// + /// + /// The ITextRange::GetText method returns the plain text in the range. The Text property is the default property for ITextRange; this is, it is automatically invoked for a range, as in the following Microsoft Visual Basic for Applications (VBA) example. + /// Some of the examples below use this fact. The ITextRange::SetText method substitutes bstr for the range text. For processing a single character, the Char property is more efficient than the Text property and does not require creating a single character range for storing a character. If the range is degenerate, the Text property lets you insert text easily. You can also delete the text in a range, as shown in the following VBA examples. + /// You can use the Text property to copy plain text from one place to another, simply by setting one range equal to another. (This is quite different from the Duplicate property; for more information, see ITextRange::GetDuplicate). The following Microsoft Visual Basic example statement sets the text in the range1 to that in range2. + /// The ranges can be in different stories or even in different applications. However, they do imply copying the text first into a BSTR and then from that string to the target location. For large amounts of text, the ITextRange::Copy and ITextRange::Paste methods can be faster, since they can perform the copy directly from source to target and with any format supported by the source and target. + /// The text returned by the Text property is given in Unicode. The end-of-paragraph mark may be given by 0x2029 (the Unicode Paragraph Separator), or by carriage return/line feed (CR/LF) (0xd, 0xa), or by a carriage return alone, depending on the original file. Microsoft Word uses a carriage return alone, unless it reads another choice in from a file, the clipboard, or an IDataObject. The placeholder for an embedded object is given by the special character, WCH_EMBEDDING, which has the Unicode value 0xFFFC. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-gettext + // HRESULT GetText( BSTR *pbstr ); + [return: MarshalAs(UnmanagedType.BStr)] + new string GetText(); - /// - /// Not implemented. - /// Gets a cells object with the parameters of cells in the currently selected table row or column. - /// - /// - /// Type: IUnknown** - /// The cells object. + /// Sets the text in this range. + /// + /// Type: BSTR + /// Text that replaces the current text in this range. If null, the current text is deleted. + /// + /// + /// + /// ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed the text in. For UI selection behavior, see TypeText. + /// If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the ITextRange::SetText method (unless some other range has changed that text in between the calls). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-settext + // HRESULT SetText( [in] BSTR bstr ); + new void SetText([MarshalAs(UnmanagedType.BStr)] string bstr); + + /// Gets the character at the start position of the range. + /// + /// Type: long* + /// The start character position of the range. + /// + /// + /// The following Microsoft Visual Basic example sets ch equal to the character at the start of the range. + /// Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as bytes, words, variable-length, and so forth), and they do not require using a BSTR. + /// The Char property, which can do most things that a characters collection can, has two big advantages: + /// + /// + /// It can reference any character in the parent story instead of being limited to the parent range. + /// + /// + /// It is significantly faster, since LONGs are involved instead of range objects. + /// + /// + /// Accordingly, the Text Object Model (TOM) does not support a characters collection. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getchar + // HRESULT GetChar( long *pChar ); + new int GetChar(); + + /// Sets the character at the starting position of the range. + /// + /// Type: long + /// New value for character at the starting position. + /// + /// + /// + /// ITextRange::SetChar lets you specify the precise character code to use. However, string literals with similar looking glyphs can be misleading. + /// The characters set by this method are LONG instead of a BSTR. This hides the way that they are stored in the backing store, (as bytes, words, variable-length, and so forth). + /// Frequently on systems that do not have automatic word-wrapping, documents have hard carriage returns inserted just for line breaks. The following code shows a simple, but not perfect, way to convert such hard carriage returns back to blanks for the story that is associated with the range r. + /// Alternatively, you could use the following inside the IF loop. + /// This approach enables you to wrap the text to other widths. However, the algorithm isn't perfect: it assumes that a hard carriage return that is followed by anything other than white space (blank, tab, line feed, carriage return, and so forth) should be replaced by a blank. The algorithm also assumes that the carriage return character is a single character like carriage return or the Unicode end-of-paragraph (EOP) 0x2029 character. And, the combination carriage return and line feed isn't matched and would require writing and executing more code (or use ). Another caution is that there are other cases, such as mixed code and documentation, where the algorithm does not work correctly. + /// However, ITextRange::SetChar is more efficient than a replace operation that is accomplished by a delete followed by an insertion. Thus, rewriting the code without using ITextRange::SetChar would probably be much slower. + /// The Char property, which can do most things that a characters collection can, has two big advantages: it can reference any character in the parent story instead of being limited to the parent range, and it's significantly faster, since LONGs rather than range objects are involved. Because of these advantages, the Text Object Model (TOM) does not support a characters collection. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setchar + // HRESULT SetChar( long Char ); + new void SetChar(int Char); + + /// Gets a duplicate of this range object. + /// + /// Type: ITextRange** + /// The duplicate of the range. + /// + /// + /// To create an insertion point in order to traverse a range, first duplicate the range and then collapse the duplicate at its start character position. Note, a range is characterized by start and end character positions, and the story it belongs to. + /// Even if the range is actually an ITextSelection, the duplicate returned is an ITextRange. For an example, see the ITextRange::FindText method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getduplicate + // HRESULT GetDuplicate( ITextRange **ppRange ); + new ITextRange GetDuplicate(); + + /// Gets an ITextRange object with the specified range's formatted text. + /// + /// Type: ITextRange** + /// The ITextRange object with the formatted text. + /// + /// + /// This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for Applications (VBA)-friendly. The method returns the formatted text in a range. If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface. + /// Among the formats typically supported by IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the FormattedText property to replace the text in a range2, by the formatted text in range1. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getformattedtext + // HRESULT GetFormattedText( ITextRange **ppRange ); + new ITextRange GetFormattedText(); + + /// Sets the formatted text of this range text to the formatted text of the specified range. + /// + /// Type: ITextRange* + /// The formatted text to replace this range's text. + /// + /// + /// If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface. + /// Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the FormattedText property to replace the text in range2 with the formatted text in range1. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setformattedtext + // HRESULT SetFormattedText( [in] ITextRange *pRange ); + new void SetFormattedText([In, Optional] ITextRange? pRange); + + /// Gets the start character position of the range. + /// + /// Type: long* + /// The start character position. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstart + // HRESULT GetStart( long *pcpFirst ); + new int GetStart(); + + /// Sets the character position for the start of this range. + /// + /// Type: long + /// The new character position for the start of the range. + /// + /// + /// Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst, making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled into view if the display isn't frozen. + /// ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following example shows how to convert a nondegenerate range into a degenerate one (insertion point). + /// Similarly, converts the range into an insertion point at the end position. + /// The following example adds 1 to the end position, if it is not at the end of the story. + /// This also makes the end position the active end of the range, and it can turn a degenerate range into a nondegenerate one. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setstart + // HRESULT SetStart( [in] long cpFirst ); + new void SetStart(int cpFirst); + + /// Gets the end character position of the range. + /// + /// Type: long* + /// The end character position. + /// + /// + /// Although a pointer to a range remains valid when the text is edited, this is not the case for the character position. A character position is volatile; that is, it becomes invalid as soon as text is inserted or deleted before the character position. Be careful about using methods that return character position values, especially if the values are to be stored for any duration. + /// This method is similar to the ITextRange::GetStart method which gets the start character position of the range. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getend + // HRESULT GetEnd( long *pcpLim ); + new int GetEnd(); + + /// Sets the end position of the range. + /// + /// Type: long + /// The new end position. + /// + /// + /// If the new end position is less than the start position, this method also sets the start position to cp; that is, the range becomes an insertion point. + /// If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is scrolled into view. + /// ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a nondegenerate range, r, into a degenerate one (insertion point) at the start position, use + /// Similarly, r.Start = r.End converts r into an insertion point at the end position. + /// To add 1 to the end position, unless it is at the end of the story, use: + /// This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setend + // HRESULT SetEnd( long cpLim ); + new void SetEnd(int cpLim); + + /// Gets an ITextFont object with the character attributes of the specified range. + /// + /// Type: ITextFont** + /// The pointer to an ITextFont object. + /// + /// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on ITextFont for further details. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getfont + // HRESULT GetFont( ITextFont **ppFont ); + new ITextFont GetFont(); + + /// Sets this range's character attributes to those of the specified ITextFont object. + /// + /// Type: ITextFont* + /// A font object with the desired character format. + /// + /// + /// For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting + /// changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold + /// = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times. + /// Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it + /// values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setfont + // HRESULT SetFont( [in] ITextFont *pFont ); + new void SetFont([In, Optional] ITextFont? pFont); + + /// Gets an ITextPara object with the paragraph attributes of the specified range. + /// + /// Type: ITextPara** + /// The pointer to the ITextPara object. + /// + /// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on ITextPara for further details. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpara + // HRESULT GetPara( ITextPara **ppPara ); + new ITextPara GetPara(); + + /// Sets the paragraph attributes of this range to those of the specified ITextPara object. + /// + /// Type: ITextPara* + /// The paragraph object with the desired paragraph format. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpara + // HRESULT SetPara( [in] ITextPara *pPara ); + new void SetPara([In, Optional] ITextPara? pPara); + + /// Gets the count of characters in the range's story. + /// + /// Type: long* + /// The count of characters in the range's story. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorylength + // HRESULT GetStoryLength( long *pCount ); + new int GetStoryLength(); + + /// Get the type of the range's story. + /// + /// Type: long* + /// The type of the range's story. The pValue value can be one of the following values. + /// + /// + /// Story type + /// Value + /// Story type + /// Value + /// + /// + /// + /// tomUnknownStory + /// + /// 0 + /// + /// tomEvenPagesHeaderStory + /// + /// 6 + /// + /// + /// + /// tomMainTextStory + /// + /// 1 + /// + /// tomPrimaryHeaderStory + /// + /// 7 + /// + /// + /// + /// tomFootnotesStory + /// + /// 2 + /// + /// tomEvenPagesFooterStory + /// + /// 8 + /// + /// + /// + /// tomEndnotesStory + /// + /// 3 + /// + /// tomPrimaryFooterStory + /// + /// 9 + /// + /// + /// + /// tomCommentsStory + /// + /// 4 + /// + /// tomFirstPageHeaderStory + /// + /// 10 + /// + /// + /// + /// tomTextFrameStory + /// + /// 5 + /// + /// tomFirstPageFooterStory + /// + /// 11 + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorytype + // HRESULT GetStoryType( long *pValue ); + new tomConstants GetStoryType(); + + /// Collapses the specified text range into a degenerate point at either the beginning or end of the range. + /// + /// Type: long + /// Flag specifying the end to collapse at. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomStart or tomTrue + /// + /// Range is collapsed to the start of the range. This is the default. + /// + /// + /// + /// tomEnd or tomFalse + /// + /// Range is collapsed to the end of the range. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-collapse + // HRESULT Collapse( [in] long bStart ); + new void Collapse(tomConstants bStart); + + /// Expands this range so that any partial units it contains are completely contained. + /// + /// Type: long + /// Unit to include, if it is partially within the range. The default value is . For a list of the other Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long* + /// The count of characters added to the range. The value can be null. + /// + /// For example, if an insertion point is at the beginning, the end, or within a word, ITextRange::Expand expands the range to include that word. If the range already includes one word and part of another, ITextRange::Expand expands the range to include both words. ITextRange::Expand expands the range to include the visible portion of the range's story. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-expand + // HRESULT Expand( long Unit, long *pDelta ); + new int Expand(int Unit); + + /// Retrieves the story index of the Unit parameter at the specified range Start character position. The first Unit in a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately preceding the Unit up to the last character in the Unit. + /// + /// Type: long + /// Unit that is indexed. For a list of possible Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long* + /// The index value. The value is zero if Unit does not exist. + /// + /// + /// The ITextRange::GetIndex method retrieves the story index of a word, line, sentence, paragraph, and so forth, at the range Start. Unit specifies which kind of entity to index, such as words (tomWord), lines (tomLine), sentences (tomSentence), or paragraphs (tomParagraph). For example, ITextRange::GetIndex sets pIndex equal to the line number of the first line in the range. For a range at the end of the story, ITextRange::GetIndex, returns the number of Units in the story. Thus, you can get the number of words, lines, objects, and so forth, in a story. + /// The index value returned by the ITextRange::GetIndex method is not valid if the text is subsequently edited. Thus, users should be careful about using methods that return index values, especially if the values are to be stored for any duration. This is in contrast to a pointer to a range, which does remain valid when the text is edited. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getindex + // HRESULT GetIndex( long Unit, long *pIndex ); + new int GetIndex(int Unit); + + /// Changes this range to the specified unit of the story. + /// + /// Type: long + /// Unit used to index the range. For a list of unit values, see ITextRange. + /// + /// + /// Type: long + /// Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of Units begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in the story corresponds to an Index of -1. + /// + /// + /// Type: long + /// Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start position of the specified Unit. If nonzero, the range is set to the entire Unit. + /// + /// This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, converts a range to an insertion point at the start of the tenth line. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setindex + // HRESULT SetIndex( [in] long Unit, [in] long Index, [in] long Extend ); + new void SetIndex(int Unit, int Index, int Extend); + + /// Adjusts the range endpoints to the specified values. + /// + /// Type: long + /// The character position for the anchor end of the range. + /// + /// + /// Type: long + /// The character position for the active end of the range. + /// + /// + /// This method sets the range's start position to , and the end position to . If the range is a nondegenerate selection, cpAnchor is the active end, and cpAnchor is the anchor end. If the range is a degenerate selection, the selection is displayed at the start of the line, rather than at the end of the previous line. + /// This method removes any other subranges this range may have. To preserve the current subranges, use ITextRange2::SetActiveSubrange. + /// If the text range is a selection, you can set the attributes of the selection by using the ITextSelection::SetFlags method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setrange + // HRESULT SetRange( long cpAnchor, long cpActive ); + new void SetRange(int cpAnchor, int cpActive); + + /// Determines whether this range is within or at the same text as a specified range. + /// + /// Type: ITextRange* + /// Text that is compared to the current range. + /// + /// + /// Type: long* + /// The comparison result. The pointer can be null. The method returns pB is tomTrue only if the range is in or at the same text as pRange. + /// + /// + /// For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the following statements. + /// + /// + /// The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical insertion points. + /// + /// + /// Range2 is a nondegenerate range with start and end character positions at or within those of range1. + /// + /// + /// The following example shows how to walk one range with another. + /// When the ITextRange::FindText, ITextRange::MoveWhile, and ITextRange::MoveUntil method families are used, you can use one range to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in ITextRange::Find). + /// ITextRange::IsEqual is a special case of ITextRange::InRange that returns pBtomTrue if the pRange has the same start and end character positions and belongs to the same story. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-inrange + // HRESULT InRange( ITextRange *pRange, long *pValue ); + new tomConstants InRange([In, Optional] ITextRange? pRange); + + /// Determines whether this range's story is the same as a specified range's story. + /// + /// Type: ITextRange* + /// The ITextRange object whose story is compared to this range's story. + /// + /// + /// Type: long* + /// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range's story is the same as that of the pRange; otherwise it receives tomFalse. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-instory + // HRESULT InStory( ITextRange *pRange, long *pValue ); + new tomConstants InStory([In, Optional] ITextRange? pRange); + + /// Determines whether this range has the same character positions and story as those of a specified range. + /// + /// Type: ITextRange* + /// The ITextRange object that is compared to this range. + /// + /// + /// Type: long* + /// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range points at the same text (has the same start and end character positions and story) as pRange; otherwise it returns tomFalse. + /// + /// The ITextRange::IsEqual method returns tomTrue only if the range points at the same text as pRange. See Finding Rich Text for code that compares two different pieces of text to see if they contain the same plain text and the same character formatting. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-isequal + // HRESULT IsEqual( ITextRange *pRange, long *pValue ); + new tomConstants IsEqual([In, Optional] ITextRange? pRange); + + /// Sets the start and end positions, and story values of the active selection, to those of this range. + /// + /// The active end of the new selection is at the end position. + /// The caret for an ambiguous character position is displayed at the beginning of the line. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-select + // HRESULT Select(); + new void Select(); + + /// Moves the range ends to the start of the first overlapping Unit in the range. + /// + /// Type: long + /// Unit to use in the move operation. For a list of Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long + /// How to move the ends of the range. It can be one of the following values. + /// + /// + /// 0 (or tomMove) + /// Collapses a nondegenerate range to the start position by moving the insertion point. This is the default. + /// + /// + /// 1 (or tomExtend) + /// Moves the start position to the beginning of the overlapping Unit. Does not move the end position. + /// + /// + /// + /// + /// Type: long* + /// Pointer to a variable that receives the number of characters that the start position is moved. It can be null. On return, pDelta is the signed number of characters that the insertion point or start position is moved. This value is always less than or equal to zero, because the motion is always toward the beginning of the story. + /// + /// + /// If the range is an insertion point on a boundary between Units, ITextRange::StartOf does not change the start position. + /// The ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend from the active end, whereas ITextRange::StartOf extends from the start position and ITextRange::EndOf extends from the end position. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-startof + // HRESULT StartOf( long Unit, long Extend, long *pDelta ); + new tomConstants StartOf(tomConstants Unit, tomConstants Extend); + + /// Moves this range's ends to the end of the last overlapping Unit in the range. + /// + /// Type: long + /// Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long + /// Indicator of how the shifting of the range ends is to proceed. It can be one of the following. + /// + /// + /// 0 or tomMove + /// Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default. + /// + /// + /// 1 (or tomExtend) + /// Moves End to the end of the overlapping Unit. Does not move Start. + /// + /// + /// + /// + /// Type: long* + /// The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to –1, to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the final CR). + /// + /// For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf extends from End. If the range is an insertion point on a boundary between Units, ITextRange::EndOf does not change End. In particular, calling ITextRange::EndOf (tomCharacter, *, *) does not change End except for an insertion point at the beginning of a story. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-endof + // HRESULT EndOf( long Unit, long Extend, long *pDelta ); + new tomConstants EndOf(tomConstants Unit, tomConstants Extend); + + /// Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed to an insertion point at either end, depending on Count, and then is moved. + /// + /// Type: long + /// Unit to use. The default value is tomCharacter. For information on other values, see the discussion in ITextRange. + /// + /// + /// Type: long + /// Number of Units to move past. The default value is 1. If Count is greater than zero, motion is forward—toward the end of the story—and if Count is less than zero, motion is backward—toward the beginning. If Count is zero, the range is unchanged. + /// + /// + /// Type: long* + /// The actual number of Units the insertion point moves past. The pointer can be NULL. For more information, see the Remarks section. + /// + /// + /// If the range is degenerate (an insertion point), this method tries to move the insertion point Count Units. + /// If the range is nondegenerate and Count is greater than zero, this method collapses the range at the end character position, moves the resulting insertion point forward to a Unit boundary (if it is not already at one), and then tries to move Count - 1 Units forward. If the range is nondegenerate and Count is less than zero, this method collapses the range at the start character position, moves the resulting insertion point backward to a Unit boundary (if it isn't already at one), and then tries to move |Count| - 1 Units backward. Thus, in both cases, collapsing a nondegenerate range to an insertion point, whether moving to the start or end of the Unit following the collapse, counts as a Unit. + /// The ITextRange::Move method returns pDelta = number of Units actually moved. This method never moves the insertion point beyond the story of this range. If CountUnits would move the insertion point before the beginning of the story, it is moved to the story beginning and pDelta is set accordingly. Similarly, if Count Units would move it beyond the end of the story, it is moved to the story end. + /// The ITextRange::Move method works similarly to the UI-oriented MoveLeft and MoveRight methods, except that the direction of motion is logical rather than geometrical. That is, with ITextRange::Move the direction is either toward the end or toward the start of the story. Depending on the language, moving toward the end of the story could be moving to the left or to the right. To get a feel for Count, press Ctrl+Right Arrow in a Microsoft Word document for a variety of selections. In left-to-right text, this keystroke behaves the same as , and . Count corresponds to the number of times you press Ctrl+Right Arrow. + /// For example, if you press Ctrl+Right Arrow for the selections shown in both of the following figures, you end up with an insertion point at character position 8, since this command collapses the selections at their end character positions (7 and 8, respectively) and moves to the next tomWord boundary. + /// The first selection does not include the blank space at character position 7, so Ctrl+Right Arrow moves past the space to the tomWord boundary at character position 8. The end character position is already at a tomWord boundary for the second selection, so Ctrl+Right Arrow just collapses the selection at that boundary. Similarly, Ctrl+Left Arrow, which for this text acts like , and collapses the first selection at character position 5, which is already at a tomWord boundary, so no more motion occurs. But Ctrl+Left Arrow collapses the second selection at character position 4 and then moves to zero, since that's the next tomWord boundary in the direction of motion. + /// The return argument, pDelta, is set equal to the number of Units that the insertion point is moved including one Unit for collapsing a nondegenerate range and moving it to a Unit boundary. So, if no motion and no collapse occur, as when the range is an insertion point at the end of the story, pDelta is set equal to zero. This approach is useful for controlling program loops that process a whole story. + /// In both of the cases mentioned above, calling sets pDelta equal to 1 because the ranges were collapsed. Similarly, calling sets pDelta equal to -1 for both cases. Collapsing, with or without moving part of a Unit to a Unit boundary, counts as a Unit moved. + /// The direction of motion refers to the logical character ordering in the plain-text backing store. This approach avoids the problems of geometrical ordering, such as left versus right and up versus down, in international software. Such geometrical methods are still needed in the edit engine, of course, since keyboards have arrow keys to invoke them. If the range is really an ITextSelection object, then methods like MoveLeft and MoveRight can be used. + /// If Unit specifies characters (tomCharacter), the Text Object Model (TOM) uses the Unicode character set. To convert between Unicode and multibyte character sets the MultiByteToWideChar and WideCharToMultiByte functions provide easy ways to convert between Unicode and multibyte character sets on import and export, respectively. For more information, see Open. In this connection, the use of a carriage return/line feed (CR/LF) to separate paragraphs is as problematic as double-byte character set (DBCS). The ITextSelection UI methods back up over a CR/LF as if it were a single character, but the ITextRange::Move methods count CR/LFs as two characters. It's clearly better to use a single character as a paragraph separator, which in TOM is represented by a character return, although the Unicode paragraph separator character, 0x2029, is accepted. In general, TOM engines should support CR/LF, carriage return (CR), line feed (LF), vertical tab, form feed, and 0x2029. Microsoft Rich Edit 2.0 also supports CR/CR/LF for backward compatibility. + /// See also the ITextRange::MoveStart and ITextRange::MoveEnd methods, which move the range Start or End position Count Units, respectively. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-move + // HRESULT Move( long Unit, long Count, long *pDelta ); + new tomConstants Move(tomConstants Unit, int Count); + + /// Moves the start position of the range the specified number of units in the specified direction. + /// + /// Type: long + /// Unit used in the move. The default value is tomCharacter. For a list of the other Unit values, see the discussion under ITextRange. + /// + /// + /// Type: long + /// Number of units to move. The default value is 1. If Count is greater than zero, motion is forward—toward the end of the story—and if Count is less than zero, motion is backward—toward the beginning. If Count is zero, the start position is unchanged. + /// + /// + /// Type: long* + /// The actual number of units that the end is moved. The value can be null. + /// + /// + /// If the new start follows the old end, the new end is set equal to the new start. + /// The motion described by ITextRange::MoveStart is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestart + // HRESULT MoveStart( long Unit, long Count, long *pDelta ); + new tomConstants MoveStart(tomConstants Unit, int Count); + + /// Moves the end position of the range. + /// + /// Type: long + /// The units by which to move the end of the range. The default value is tomCharacter. For a list of the other unit values, see ITextRange. + /// + /// + /// Type: long + /// The number of units to move past. The default value is 1. If Count is greater than zero, motion is forward—toward the end of the story—and if Count is less than zero, motion is backward—toward the beginning. If Count is zero, the end position is unchanged. + /// + /// + /// Type: long* + /// The actual number of units that the end position of the range is moved past. The value can be null. + /// + /// + /// If the new end position precedes the old start position, the new start position is set equal to the new end position; that is, it becomes a degenerate range or an insertion point. + /// The motion described by ITextRange::MoveEnd is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveend + // HRESULT MoveEnd( long Unit, long Count, long *pDelta ); + new tomConstants MoveEnd(tomConstants Unit, int Count); + + /// Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching character is found. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is less than zero, the search starts at the start position and goes backward — toward the beginning of the story. If Count is greater than zero, the search starts at the end position and goes forward — toward the end of the story. + /// + /// + /// Type: long* + /// The actual count of characters end is moved. This parameter can be null. + /// + /// + /// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move. + /// The ITextRange::MoveWhile method is similar to ITextRange::MoveUntil, but MoveWhile searches as long as it finds members of the set specified by Cset, and there is no additional increment to the value pDelta. + /// The ITextRange::MoveStartWhile and ITextRange::MoveEndWhile methods move the start and end, respectively, just past all contiguous characters that are found in set of characters specified by the Cset parameter. + /// The VARIANT type is primarily intended to be used with IDispatch scenarios like Microsoft Visual Basic for Applications (VBA), but it can be readily used from C or C++ as well. The following C++ code illustrates how to initialize and use the VARIANT argument for matching a span of digits in the range r. + /// Alternatively, an explicit string could be used, as in the following sample. + /// The following VBA example code matches the body of the next Standard Generalized Markup Language (SGML) entry in a range, r. SGML entries start with < > and end with </ >. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movewhile + // HRESULT MoveWhile( VARIANT *Cset, long Count, long *pDelta ); + new int MoveWhile([In] object Cset, int Count); + + /// Moves the start position of the range either Count characters, or just past all contiguous characters that are found in the set of characters specified by Cset, whichever is less. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search is forward—toward the end of the story—and if Count is less than zero, search is backward—toward the beginning. If Count is zero, the start position is unchanged. + /// + /// + /// Type: long* + /// The actual count of characters that the start position is moved. This parameter can be null. + /// + /// + /// If the new start follows the old end, the new end is set equal to the new start. + /// The motion described by ITextRange::MoveStartWhile is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartwhile + // HRESULT MoveStartWhile( VARIANT *Cset, long Count, long *pDelta ); + new int MoveStartWhile([In] object Cset, int Count); + + /// Moves the end of the range either Count characters or just past all contiguous characters that are found in the set of characters specified by Cset, whichever is less. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged. + /// + /// + /// Type: long* + /// The actual number of characters that the end is moved. The value can be null. + /// + /// + /// If the new end precedes the old start, the new start is set equal to the new end. + /// The motion described by ITextRange::MoveEndWhile is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveendwhile + // HRESULT MoveEndWhile( VARIANT *Cset, long Count, long *pDelta ); + new int MoveEndWhile([In] object Cset, int Count); + + /// Searches up to Count characters for the first character in the set of characters specified by Cset. If a character is found, the range is collapsed to that point. The start of the search and the direction are also specified by Count. + /// + /// Type: VARIANT* + /// The character set used in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is less than zero, the search is backward starting at the start position. If Count is greater than zero, the search is forward starting at the end. + /// + /// + /// Type: long* + /// The number of characters the insertion point is moved, plus 1 for a match if Count is greater than zero, and –1 for a match if Count less than zero. The pointer can be null. + /// + /// + /// If no character is matched, the range is unchanged. + /// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move. + /// The ITextRange::MoveStartUntil and ITextRange::MoveEndUntil methods move the start and end, respectively, until it finds the first character that is also in the set specified by the Cset parameter. + /// The ITextRange::MoveUntil method is similar to ITextRange::MoveWhile, but there are two differences. First, MoveUntil moves an insertion point until it finds the first character that belongs to the character set specified by Cset. Second, in MoveUntil the character matched counts as an additional character in the value returned in pDelta. This lets you know that the character at one end of the range or the other belongs to the Cset even though the insertion point stays at one of the range ends. + /// For example, suppose the range, r, is an insertion point. To see if the character at r (that is, given by r.GetChar()) is in Cset, call + /// If the character is in Cset, the return value is 1 and the insertion point does not move. Similarly, to see if the character preceding r is in Cset, call + /// If the character is in Cset, the return value is –1. + /// The following Microsoft Visual Basic for Applications (VBA) subroutine prints all numbers in the story identified by the range, r. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveuntil + // HRESULT MoveUntil( VARIANT *Cset, long Count, long *pDelta ); + new int MoveUntil([In] object Cset, int Count); + + /// Moves the start position of the range the position of the first character found that is in the set of characters specified by Cset, provided that the character is found within Count characters of the start position. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search is forward—toward the end of the story—and if Count is less than zero, search is backward—toward the beginning. If Count is zero, the start position is unchanged. + /// + /// + /// Type: long* + /// The actual number of characters the start of the range is moved, plus 1 for a match if Count is greater than zero, and –1 for a match if Count is less than zero. The value can be null. + /// + /// + /// If no character from Cset is found within Count positions of the start position, the range is left unchanged. + /// If the new start follows the old end, the new end is set equal to the new start. + /// The motion described by ITextRange::MoveStartUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartuntil + // HRESULT MoveStartUntil( VARIANT *Cset, long Count, long *pDelta ); + new int MoveStartUntil([In] object Cset, int Count); + + /// Moves the range's end to the character position of the first character found that is in the set of characters specified by Cset, provided that the character is found within Count characters of the range's end. + /// + /// Type: VARIANT* + /// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. + /// + /// + /// Type: long + /// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged. + /// + /// + /// Type: long* + /// The actual number of characters that the range end is moved, plus 1 for a match if Count is greater than zero, and –1 for a match if Count is less than zero. The value can be null. + /// + /// + /// If no character from the set specified by Cset is found within Count positions of the range's end, the range is left unchanged. If the new end precedes the old start, the new start is set equal to the new end. + /// The motion described by ITextRange::MoveEndUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right. + /// For more information, see ITextRange and ITextRange::Move. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveenduntil + // HRESULT MoveEndUntil( VARIANT *Cset, long Count, long *pDelta ); + new int MoveEndUntil([In] object Cset, int Count); + + /// Searches up to Count characters for the text given by bstr. The starting position and direction are also specified by Count, and the matching criteria are given by Flags. + /// + /// Type: BSTR + /// String to find. + /// + /// + /// Type: long + /// Maximum number of characters to search. It can be one of the following. + /// + /// + /// + /// tomForward + /// + /// Searches to the end of the story. This is the default value. + /// + /// + /// + /// n (greater than 0) + /// Searches forward for n chars, starting from cpFirst. If the range itself matches bstr, another search is attempted from cpFirst + 1. + /// + /// + /// + /// n(less than 0) + /// Searches backward for n chars, starting from cpLim. If the range itself matches bstr, another search is attempted from cpLim– 1. + /// + /// + /// 0 (degenerate range) + /// Search begins after the range. + /// + /// + /// 0 (nondegenerate range) + /// Search is limited to the range. + /// + /// + ///  + /// In all cases, if a string is found, the range limits are changed to be those of the matched string and pLength is set equal to the length of the string. If the string is not found, the range remains unchanged and pLength is set equal to zero. + /// + /// + /// Type: long + /// Flags governing comparisons. It can be 0 (the default) or any combination of the following values. + /// + /// + /// + /// tomMatchWord + /// + /// 2 + /// Matches whole words. + /// + /// + /// + /// tomMatchCase + /// + /// 4 + /// Matches case. + /// + /// + /// + /// tomMatchPattern + /// + /// 8 + /// Matches regular expressions. + /// + /// + /// + /// + /// Type: long* + /// The length of string matched. + /// + /// + /// The ITextRange::FindText method can also match special characters by using a caret (^) followed by a special letter. For a list of special characters, see the Special list available in the Microsoft Word Find and Replace dialog box. For example, matches the next paragraph mark. Note, can be used to represent the Clipboard contents in the string to be replaced. Thus, using in the find string enables you to search for rich text. For more details, see the Word Help files. + /// As a comparison with the ITextRange::FindText method, the ITextRange::FindTextStart method searches forward or backward from the range's Start cp, and the ITextRange::FindTextEnd method searches forward or backward from the range's End cp. For more details, see the descriptions of these methods. + /// The following are several code snippets that show the ITextRange::FindText methods. + /// Example #1. The following Microsoft Visual Basic for Applications (VBA) program prints all the /* ... */ comments in a story identified by the range r. + /// Instead of these comments being printed, they could be inserted into another edit instance and saved to a file, or they could be inserted into separate cells in a table or spreadsheet. + /// To print all lines containing one or more occurrences of the word "laser", replace the loop by the following code: + /// Example #2. The following program prints a telephone list, given a story that contains an address list. The address list entries are separated by two or more paragraph marks, and each entry has the following form. + /// Note the use of the character in the FindText string argument to locate a pair of consecutive paragraph marks. + /// Example #3. The following subroutine replaces all occurrences of the string, str1, in a range by str2: + /// Example #4. The following line of code inserts a blank before the first occurrence of a right parenthesis, "(", that follows an occurrence of HRESULT. + /// To do this for all such occurrences, change the If into a While/Wend loop in the above line of code. This an example of a FIND/REPLACE macro that cannot be run with Find and Replace dialog boxes. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtext + // HRESULT FindText( BSTR bstr, long Count, long Flags, long *pLength ); + new int FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags); + + /// Searches up to Count characters for the string, bstr, starting at the range's Start cp (cpFirst). The search is subject to the comparison parameter, Flags. If the string is found, the Start cp is changed to the matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged, and pLength is set equal to zero. + /// + /// Type: BSTR + /// The string to search for. + /// + /// + /// Type: long + /// Maximum number of characters to search. It can be one of the following. + /// + /// + /// + /// tomForward + /// + /// Search to the end of the story. This is the default value. + /// + /// + /// + /// n (greater than 0) + /// Search forward for n chars, starting from cpLim. + /// + /// + /// + /// n (less than 0) + /// Search backward for n chars, starting from cpLim. + /// + /// + /// + /// + /// Type: long + /// Flags governing the comparisons. It can be zero (the default) or any combination of the following values. + /// + /// + /// + /// tomMatchWord + /// + /// 2 + /// Matches whole words. + /// + /// + /// + /// tomMatchCase + /// + /// 4 + /// Matches case. + /// + /// + /// + /// tomMatchPattern + /// + /// 8 + /// Matches regular expressions. + /// + /// + /// + /// + /// Type: long* + /// The length of the matched string. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextstart + // HRESULT FindTextStart( BSTR bstr, long Count, long Flags, long *pLength ); + new int FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags); + + /// Searches up to Count characters for the string, bstr, starting from the range's End cp. The search is subject to the comparison parameter, Flags. If the string is found, the End cp is changed to be the end of the matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged and pLength is set equal to zero. + /// + /// Type: BSTR + /// String to search for. + /// + /// + /// Type: long + /// Maximum number of characters to search. It can be one of the following. + /// + /// + /// + /// tomForward + /// + /// Search to the end of the story. This is the default value. + /// + /// + /// + /// n (greater than 0) + /// Search forward for n chars, starting from cpLim. + /// + /// + /// + /// n (less than 0) + /// Search backward for n chars, starting from cpLim. + /// + /// + /// + /// + /// Type: long + /// Flags governing comparisons. It can be zero (the default) or any combination of the following values. + /// + /// + /// + /// tomMatchWord + /// + /// 2 + /// Matches whole words. + /// + /// + /// + /// tomMatchCase + /// + /// 4 + /// Matches case. + /// + /// + /// + /// tomMatchPattern + /// + /// 8 + /// Matches regular expressions. + /// + /// + /// + /// + /// Type: long* + /// The length of string matched. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextend + // HRESULT FindTextEnd( BSTR bstr, long Count, long Flags, long *pLength ); + new int FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags); + + /// Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed. + /// + /// Type: long + /// Unit to use. Unit can be tomCharacter (the default value) or tomWord. + /// + /// + /// Type: long + /// Number of Units to delete. If Count= zero, it deletes the text in the range only. If Count is greater than zero, ITextRange::Delete acts as if the DELETE key was pressed Count times. If Count is less than zero, it acts as if the BACKSPACE key was pressed Count times. The default value is 1. For more information, see the Remarks. + /// + /// + /// Type: long* + /// The count of units deleted. It can be null. The pDelta parameter is set equal to the number of Units deleted. Deleting the text in a nondegenerate range counts as one Unit. + /// + /// + /// If Count = zero, this method deletes the text in the range, that is, it deletes nothing if the range is only an insertion point. + /// If Count is not zero, and the range is an insertion point (that is, degenerate), | Count| (absolute value of Count) Units are deleted in the logical direction given by the sign of Count, where a positive value is the direction toward the end of the story, and a negative value is toward the start of the story. + /// If Count is not zero, and the range is nondegenerate (contains text), the text in the range is deleted (regardless of the values of Unit and Count), thereby creating an insertion point. Then, | Count| - 1  Units are deleted in the logical direction given by the sign of Count. + /// The text in the range can also be deleted by assigning a null string to the range (executing statement r = where r is the range). However, ITextRange::Delete does not require allocating a BSTR. + /// Deleting the end-of-paragraph mark (CR) results in the special behavior of the Microsoft Word UI. Four cases are of particular interest: + /// + /// + /// If you delete just the CR but the paragraph includes text, then the CR is deleted, and the following paragraph gets the same paragraph formatting as current one. + /// + /// + /// If you delete the CR as well as some, but not all, of the characters in the following paragraph, the characters left over from the current paragraph get the paragraph formatting of the following paragraph. + /// + /// + /// If you select to the end of a paragraph, but not the whole paragraph, the CR is not deleted. + /// + /// + /// If you delete the whole paragraph (from the beginning through the CR), you delete the CR as well (unless it is the final CR in the file). + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-delete + // HRESULT Delete( long Unit, long Count, long *pDelta ); + new int Delete(tomConstants Unit, int Count); + + /// Cuts the plain or rich text to a data object or to the Clipboard, depending on the pVar parameter. + /// + /// Type: VARIANT* + /// The cut text. pVar->ppunkVal is the out parameter for an IDataObject object, provided that the following conditions exist: + /// + /// + /// pVar->vt = (VT_UNKNOWN | VT_BYREF) + /// + /// + /// pVar is not null + /// + /// + /// pVar->ppunkVal is not null + /// + /// + /// Otherwise, the clipboard is used. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-cut + // HRESULT Cut( VARIANT *pVar ); + new void Cut(out object pVar); + + /// Copies the text to a data object. + /// + /// Type: VARIANT* + /// The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist: + /// + /// + /// pVar->vt = (VT_UNKNOWN | VT_BYREF) + /// + /// + /// pVar is not null + /// + /// + /// pVar->ppunkVal is not null + /// + /// + /// Otherwise, the clipboard is used. + /// + /// + /// The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy, and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to reference a text solution's own internal rich text formats. + /// To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example: + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-copy + // HRESULT Copy( VARIANT *pVar ); + new void Copy(out object pVar); + + /// Pastes text from a specified data object. + /// + /// Type: VARIANT* + /// The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true. + /// pVar is null + /// pVar punkVal is null + /// pVar is not VT_UNKNOWN + /// pVar punkVal does not return an IDataObject when queried for one + /// + /// + /// Type: long + /// The clipboard format to use in the paste operation. Zero is best format, which usually is RTF, but CF_UNICODETEXT and other formats are also possible. The default value is zero. For more information, see Clipboard Formats. /// /// /// Type: HRESULT - /// If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code. + /// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM. + /// + /// + /// Return code + /// Description + /// + /// + /// E_ACCESSDENIED + /// Destination is write-protected. + /// + /// + /// E_OUTOFMEMORY + /// Destination cannot contain the text to be pasted. + /// + /// + /// + /// For more information, seeITextRange::Copy. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-paste + // HRESULT Paste( VARIANT *pVar, long Format ); + new void Paste([In] object pVar, int Format); + + /// Determines if a data object can be pasted, using a specified format, into the current range. + /// + /// Type: VARIANT* + /// The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true: + /// + /// + /// + /// pVar is null + /// + /// + /// + /// pVar->punkVal is null + /// + /// + /// + /// pVar->vt is not VT_UNKNOWN + /// + /// + /// + /// pVar->punkVal does not return an IDataObject object when queried for one + /// + /// + /// + /// + /// Type: long + /// Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats are also possible. The default value is zero. + /// + /// + /// Type: long* + /// A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified format, into the range. This parameter can null. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canpaste + // HRESULT CanPaste( VARIANT *pVar, long Format, long *pValue ); + new tomConstants CanPaste([In] object pVar, int Format); + + /// Determines whether the specified range can be edited. + /// + /// Type: long* + /// A tomBool value indicating whether the range can be edited. It is tomTrue only if the specified range can be edited. The pointer can be null. + /// + /// The range cannot be edited if any part of it is protected or if the document is read-only. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canedit + // HRESULT CanEdit( [retval] long *pValue ); + new tomConstants CanEdit(); + + /// Changes the case of letters in this range according to the Type parameter. + /// + /// Type: long + /// Type of case change. The default value is tomLower. + /// + /// + /// Value + /// Meaning + /// + /// + /// + /// tomLowerCase 0 + /// Sets all text to lowercase. + /// + /// + /// + /// tomUpperCase 1 + /// Sets all text to lowercase. + /// + /// + /// + /// tomTitleCase 2 + /// Capitalizes the first letter of each word. + /// + /// + /// + /// tomSentenceCase 4 + /// Capitalizes the first letter of each sentence. + /// + /// + /// + /// tomToggleCase 5 + /// Toggles the case of each letter. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-changecase + // HRESULT ChangeCase( [in] long Type ); + new void ChangeCase(tomConstants Type); + + /// Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position. + /// + /// Type: long + /// Flag that indicates the position to retrieve. This parameter can include one value from each of the following tables. The default value is tomStart + TA_BASELINE + TA_LEFT. + /// tomAllowOffClient + /// tomClientCoord + /// tomObjectArg + /// tomTransform + /// Use one of the following values to indicate the start or end of the range. + /// tomStart + /// tomEnd + /// Use one of the following values to indicate the vertical position. + /// + /// + /// TA_TOP + /// Top edge of the bounding rectangle. + /// + /// + /// TA_BASELINE + /// Base line of the text. + /// + /// + /// TA_BOTTOM + /// Bottom edge of the bounding rectangle. + /// + /// + /// Use one of the following values to indicate the horizontal position. + /// + /// + /// TA_LEFT + /// Left edge of the bounding rectangle. + /// + /// + /// TA_CENTER + /// Center of the bounding rectangle. + /// + /// + /// TA_RIGHT + /// Right edge of the bounding rectangle. + /// + /// + /// + /// + /// Type: long* + /// The x-coordinate. + /// + /// + /// Type: long* + /// The y-coordinate. + /// + /// The ITextRange::GetPoint method gives ITextRange the ability to emulate UI-pointer commands; it is also handy for accessibility purposes. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpoint + // HRESULT GetPoint( long Type, long *px, long *py ); + new void GetPoint(int Type, out int px, out int py); + + /// Changes the range based on a specified point at or up through (depending on Extend) the point (x, y) aligned according to Type. + /// + /// Type: long + /// Horizontal coordinate of the specified point, in absolute screen coordinates. + /// + /// + /// Type: long + /// Vertical coordinate of the specified point, in absolute screen coordinates. + /// + /// + /// Type: long + /// The end to move to the specified point. It can be one of the following. + /// + /// + /// + /// tomStart + /// + /// Move the start of range. + /// + /// + /// + /// tomEnd + /// + /// Move the end of range. + /// + /// + /// + /// + /// Type: long + /// How to set the endpoints of the range. If Extend is zero (the default), the range is an insertion point at the specified point (or at the nearest point with selectable text). If Extend is 1, the end specified by Type is moved to the point and the other end is left alone. + /// + /// An application can use the specified point in the WindowFromPoint function to get the handle of the window, which usually can be used to find the client-rectangle coordinates (although a notable exception is with Windowless Controls). + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpoint + // HRESULT SetPoint( [in] long x, [in] long y, [in] long Type, [in] long Extend ); + new void SetPoint(int x, int y, tomConstants Type, int Extend); + + /// Scrolls the specified range into view. + /// + /// Type: long + /// Flag specifying the end to scroll into view. It can be one of the following. + /// + /// + /// Value + /// Meaning + /// + /// + /// tomEnd + /// Scrolls the end character position to appear on the bottom line. + /// + /// + /// tomStart + /// Scrolls the start character position to appear on the top line. (Default value). + /// + /// + /// tomNoUpScroll + /// + /// + /// + /// tomNoVpScroll + /// + /// + /// + /// + /// + /// Type: HRESULT + /// The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-scrollintoview + // HRESULT ScrollIntoView( long Value ); + [PreserveSig] + new HRESULT ScrollIntoView(tomConstants Value); + + /// Retrieves a pointer to the embedded object at the start of the specified range, that is, at cpFirst. The range must either be an insertion point or it must select only the embedded object. + /// + /// Type: IUnknown** + /// The pointer to the object. + /// + /// If the start of this range does not have an embedded object or if the range selects more than a single object, ppObject is set equal to NULL. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getembeddedobject + // HRESULT GetEmbeddedObject( IUnknown **ppObject ); + [return: MarshalAs(UnmanagedType.IUnknown)] + new object GetEmbeddedObject(); + + /// Gets the count of characters in a range. + /// + /// Type: long* + /// The signed count of characters. + /// + /// The count of characters is the difference between the character position of the active end of the range, and the character position of the anchor end. Some Text Object Model (TOM) implementations might include active ends only for a selection (represented by the ITextSelection interface). The rich edit control's TOM implementation of a text range (represented by the ITextRange interface) also has active ends. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcch + // HRESULT GetCch( [out, retval] long *pcch ); + int GetCch(); + + /// + /// Not implemented. + /// Gets a cells object with the parameters of cells in the currently selected table row or column. + /// + /// + /// Type: IUnknown** + /// The cells object. /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcells // HRESULT GetCells( [out, retval] IUnknown **ppCells ); - [return: MarshalAs(UnmanagedType.IUnknown)] + [return: MarshalAs(UnmanagedType.IUnknown)] object GetCells(); + /// + /// Not implemented. + /// Gets the column properties for the currently selected column. + /// + /// + /// Type: IUnknown** + /// The column properties for the currently selected column. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcolumn + // HRESULT GetColumn( [out, retval] IUnknown **ppColumn ); [return: MarshalAs(UnmanagedType.IUnknown)] object GetColumn(); + /// Gets the count of subranges, including the active subrange in the current range. + /// + /// Type: long* + /// The count of subranges not including the active one. + /// + /// + /// If you select a range with no or one character, the count will be 1. But if you select a word and then move to a different location, and select a second word not touching the first, then the count is 2. + /// See ITextRange2::AddSubrange to add subranges programmatically. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcount + // HRESULT GetCount( [out, retval] long *pCount ); int GetCount(); + /// Gets a duplicate of a range object. + /// + /// Type: ITextRange2** + /// The duplicate range. + /// + /// If this range is an ITextSelection2 object, the duplicate returned is an ITextRange2 object. See the ITextRange::FindText method for more information. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getduplicate2 + // HRESULT GetDuplicate2( [out, retval] ITextRange2 **ppRange ); ITextRange2 GetDuplicate2(); + /// Gets an ITextFont2 object with the character attributes of the current range. + /// + /// Type: ITextFont2** + /// The ITextFont2 object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getfont2 + // HRESULT GetFont2( [out, retval] ITextFont2 **ppFont ); ITextFont2 GetFont2(); - HRESULT SetFont2([In, Optional] ITextFont2? pFont); + /// Sets the character formatting attributes of the range. + /// + /// Type: ITextFont2* + /// The font object with the desired character formatting attributes. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setfont2 + // HRESULT SetFont2( [in] ITextFont2 *pFont ); + void SetFont2([In, Optional] ITextFont2? pFont); + /// Gets an ITextRange2 object with the current range's formatted text. + /// + /// Type: ITextRange2** + /// The formatted text. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getformattedtext2 + // HRESULT GetFormattedText2( [out, retval] ITextRange2 **ppRange ); ITextRange2 GetFormattedText2(); - HRESULT SetFormattedText2([In, Optional] ITextRange2? pRange); + /// Sets the text of this range to the formatted text of the specified range. + /// + /// Type: ITextRange2* + /// The range that contains the formatted text that replaces the text of this range. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setformattedtext2 + // HRESULT SetFormattedText2( [in] ITextRange2 *pRange ); + void SetFormattedText2([In, Optional] ITextRange2? pRange); - int GetGravity(); + /// Gets the gravity of this range. + /// + /// Type: long* + /// The gravity value, which can be one of the following: + /// tomGravityUI + /// tomGravityBack + /// tomGravityFore + /// tomGravityIn + /// tomGravityOut + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getgravity + // HRESULT GetGravity( [out, retval] long *pValue ); + tomConstants GetGravity(); - HRESULT SetGravity(int Value); + /// Sets the gravity of this range. + /// + /// Type: long + /// The new gravity value, which can be one of the following. + /// tomGravityUI + /// tomGravityBack + /// tomGravityFore + /// tomGravityIn + /// tomGravityOut + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setgravity + // HRESULT SetGravity( [in] long Value ); + void SetGravity(tomConstants Value); + /// Gets an ITextPara2 object with the paragraph attributes of a range. + /// + /// Type: ITextPara2** + /// The ITextPara2 object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getpara2 + // HRESULT GetPara2( [out, retval] ITextPara2 **ppPara ); ITextPara2 GetPara2(); - HRESULT SetPara2([In, Optional] ITextPara2? pPara); + /// Sets the paragraph format attributes of a range. + /// + /// Type: ITextPara2* + /// The desired paragraph format. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setpara2 + // HRESULT SetPara2( [in] ITextPara2 *pPara ); + void SetPara2([In, Optional] ITextPara2? pPara); + /// Gets the row properties in the currently selected row. + /// + /// Type: ITextRow** + /// The row properties. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getrow + // HRESULT GetRow( [out, retval] ITextRow **ppRow ); ITextRow GetRow(); + /// Gets the character position of the start of the paragraph that contains the range's start character position. + /// + /// Type: long* + /// The start of the paragraph that contains the range's start character position. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getstartpara + // HRESULT GetStartPara( [out, retval] long *pValue ); int GetStartPara(); - [return: MarshalAs(UnmanagedType.IUnknown)] + /// + /// Not implemented. + /// Gets the table properties in the currently selected table. + /// + /// + /// Type: IUnknown** + /// The table properties. + /// + /// + /// To select the table when the insertion point is inside a table, call ITextRange::Expand(tomTable). + /// Note: this method isn't implemented in RichEdit (see ITextRow for table functionality). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-gettable + // HRESULT GetTable( [out, retval] IUnknown **ppTable ); + [return: MarshalAs(UnmanagedType.IUnknown)] object GetTable(); - HRESULT GetURL([MarshalAs(UnmanagedType.BStr)] out string pbstr); + /// Returns the URL text associated with a range. + /// + /// Type: BSTR* + /// The URL text associated with the range. + /// + /// This method sets the start and end positions of the range to that of the whole hyperlink, including the friendly name, if any. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-geturl + // HRESULT GetURL( [out, retval] BSTR *pbstr ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetURL(); - HRESULT SetURL([MarshalAs(UnmanagedType.BStr)] string bstr); + /// Sets the text in this range to that of the specified URL. + /// + /// Type: BSTR + /// The text to use as a URL for the selected friendly name. + /// + /// + /// The URL string is not validated. The text it contains must be enclosed in quotes, optionally preceded by the sentinel character 0xFDDF. For example: "http://www.msn.com" or 0xFDDF"http://www.msn.com". The range must be nondegenerate. + /// The following actions are possible: + /// + /// + /// If part of a link's friendly name is selected, the URL part is replaced with bstr. + /// + /// + /// If part of a regular URL is selected, it becomes the link's friendly name, with bstr as the URL. + /// + /// + /// If nonlink text is selected: + /// + /// + /// The text range be adjusted to different character positions after calling SetURL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-seturl + // HRESULT SetURL( [in] BSTR bstr ); + void SetURL([MarshalAs(UnmanagedType.BStr)] string bstr); - HRESULT AddSubrange(int cp1, int cp2, int Activate); + /// Adds a subrange to this range. + /// + /// Type: long + /// The active-end character position of the subrange. + /// + /// + /// Type: long + /// The anchor-end character position of the subrange. + /// + /// + /// Type: long + /// The activate parameter. If this parameter is tomTrue, the new subrange is the active subrange, with cp1 as the active end, and cp2 the anchor end. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-addsubrange + // HRESULT AddSubrange( [in] long cp1, [in] long cp2, [in] long Activate ); + void AddSubrange(int cp1, int cp2, tomConstants Activate); - HRESULT BuildUpMath(int Flags); + /// Converts the linear-format math in a range to a built-up form, or modifies the current built-up form. + /// + /// Type: long + /// A combination of the following flags. + /// tomChemicalFormula + /// tomHaveDelimiter + /// tomMathAlphabetics + /// tomMathApplyTemplate + /// tomMathArabicAlphabetics + /// tomMathAutoCorrect + /// tomMathAutoCorrectExt + /// tomMathAutoCorrectOpPairs + /// tomMathBackspace + /// tomMathBuildDown + /// tomMathBuildDownOutermost + /// tomMathBuildUpArgOrZone + /// tomMathBuildUpRecurse + /// tomMathChangeMask + /// tomMathCollapseSel + /// tomMathDeleteArg + /// tomMathDeleteArg1 + /// tomMathDeleteArg2 + /// tomMathDeleteCol + /// tomMathDeleteRow + /// tomMathEnter + /// tomMathInsColAfter + /// tomMathInsColBefore + /// tomMathInsRowAfter + /// tomMathInsRowBefore + /// tomMathMakeFracLinear + /// tomMathMakeFracSlashed + /// tomMathMakeFracStacked + /// tomMathMakeLeftSubSup + /// tomMathMakeSubSup + /// tomMathRemoveOutermost + /// tomMathRichEdit + /// tomMathShiftTab + /// tomMathSingleChar + /// tomMathSubscript + /// tomMathSuperscript + /// tomMathTab + /// tomNeedTermOp + /// tomPlain + /// tomShowEmptyArgPlaceholders + /// tomTeX + /// + /// + /// If the ITextRange2::BuildUpMath method is called on a nondegenerate range, the method checks the text for math italic conversions (if tomMathAlphabetics is specified) and math autocorrect conversions (if tomMathAutoCorrect or tomMathAutoCorrectExt is specified). Then, the method attempts to build up the selected text. If successful, the method replaces the previous text in the range with the built-up text. If the method makes any changes to the range, the function returns NOERROR and the range selects the result. If the method does change the range, it returns S_FALSE or a Component Object Model (COM) error code. + /// If the ITextRange2::BuildUpMath method is called on a degenerate range, the BuildUpMath method treats the range as an insertion point (IP) immediately following the last character input. The method converts that character, possibly along with some preceding characters, to math italic (if tomMathAlphabetics is specified), internal math autocorrect (if tomMathAutoCorrect is specified), negated operators, and some operator pairs (if tomMathAutoCorrectOpPairs is specified). If the IP is inside an argument, the method scans a range of text from the IP back to the start of a math object argument; otherwise, the method scans to the start of the current math zone. The scan is terminated by a hard carriage return or a soft end-of-paragraph mark, because math zones are terminated by these marks. A scan forward from start of the math object argument or math zone bypasses text that has no chance of being built up. If the scan reaches the original entry IP, one of the following outcomes can occur: + /// + /// + /// If the method made any changes, the function returns NOERROR and the range updated with the changed text. + /// + /// + /// If the method made no changes, the function returns S_FALSE and leaves the range unchanged. + /// + /// + /// If the scan finds text that might get built up, the BuildUpMath method attempts to build up the text up to the insertion point. If successful, the method returns NOERROR, and the range is updated with the corresponding built-up text. + /// If this full build-up attempt fails, the BuildUpMath method does a partial build-up check for the expression immediately preceding the IP. If this succeeds, the method returns NOERROR and the range contains the linear text to be replaced by the built-up text. + /// If full and partial build-up attempts fail, the function returns as described previously for the cases where no build-up text was found. Other possible return values include E_INVALIDARG (if either interface pointer is NULL) and E_OUTOFMEMORY. + /// You should set the tomNeedTermOp flag should for formula autobuildup unless autocorrection has occurred that deletes the terminating blank. Autocorrection can occur when correcting text like \alpha when the user types a blank to force autocorrection. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-buildupmath + // HRESULT BuildUpMath( [in] long Flags ); + void BuildUpMath(tomConstants Flags); - HRESULT DeleteSubrange(int cpFirst, int cpLim); + /// Deletes a subrange from a range. + /// + /// Type: long + /// The start character position of the subrange. + /// + /// + /// Type: long + /// The end character position of the subrange. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-deletesubrange + // HRESULT DeleteSubrange( [in] long cpFirst, [in] long cpLim ); + void DeleteSubrange(int cpFirst, int cpLim); - HRESULT Find([In, Optional] ITextRange2? pRange, int Count, int Flags, out int pDelta); + /// Searches for math inline functions in text as specified by a source range. + /// + /// Type: ITextRange2* + /// The formatted text to find in the range's text. + /// + /// + /// Type: long + /// The number of characters to search through. + /// + /// + /// Type: long + /// Flags that control the search as defined for ITextRange::FindText. + /// + /// + /// Type: long* + /// A count of the number of characters bypassed. + /// + /// + /// If the string is found, and the math inline functions, if any, are the same as their counterparts in the source range, the range limits are changed to be those of the matched string and length is set equal to the length of the string. + /// If the string isn't found, the range remains unchanged and length is set equal to 0. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-find + // HRESULT Find( [in] ITextRange2 *pRange, [in] long Count, [in] long Flags, [out] long *pDelta ); + tomConstants Find([In, Optional] ITextRange2? pRange, int Count, tomConstants Flags); - HRESULT GetChar2(out int pChar, int Offset); + /// Gets the character at the specified offset from the end of this range. + /// + /// Type: long* + /// The character value. + /// + /// + /// Type: long + /// The offset from the end of the range. An offset of 0 gets the character at the end of the range. + /// + /// + /// This method differs from ITextRange::GetChar in the following ways: + /// + /// + /// It returns the UTF-32 character for the surrogate pair instead of the pair's lead code. + /// + /// + /// It gets the character code, or codes, at the specified offset from the end of the range instead of the character at the start of the range. + /// + /// + /// If the character is the lead code for a surrogate pair, the corresponding UTF-32 character is returned. + /// If Offset specifies a character before the start of the story or at the end of the story, this method returns the character code 0. + /// + /// + /// If the Offset value is + /// This character is returned + /// + /// + /// 0 + /// The character at the end of the range. + /// + /// + /// Negative and accesses the middle of a surrogate pair + /// The corresponding UTF-32 character. + /// + /// + /// Positive and accesses the middle of a surrogate pair + /// The UTF-32 character following that pair. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getchar2 + // HRESULT GetChar2( [out] long *pChar, [in] long Offset ); + void GetChar2(out int pChar, int Offset); - HRESULT GetDropCap(out int pcLine, out int pPosition); + /// + /// Not implemented. + /// Gets the drop-cap parameters of the paragraph that contains this range. + /// + /// + /// Type: long* + /// The count of lines for the drop cap. A value of 0 means no drop cap. + /// + /// + /// Type: long* + /// The position of the drop cap. The position can be one of the following: + /// + /// + /// tomDropMargin + /// + /// + /// tomDropNone + /// + /// + /// tomDropNormal + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getdropcap + // HRESULT GetDropCap( [out] long *pcLine, [out] long *pPosition ); + tomConstants GetDropCap(out int pcLine); - HRESULT GetInlineObject(out int pType, out int pAlign, out int pChar, out int pChar1, out int pChar2, out int pCount, out int pTeXStyle, out int pcCol, out int pLevel); + /// Gets the properties of the inline object at the range active end. + /// + /// Type: long* + /// The inline object type can be one of the following: + /// tomSimpleText + /// tomRuby + /// tomHorzVert + /// tomWarichu + /// tomAccent + /// tomBox + /// tomBoxedFormula + /// tomBrackets + /// tomBracketsWithSeps + /// tomEquationArray + /// tomFraction + /// tomFunctionApply + /// tomLeftSubSup + /// tomLowerLimit + /// tomMatrix + /// tomNary + /// tomOpChar + /// tomOverbar + /// tomPhantom + /// tomRadical + /// tomSlashedFraction + /// tomStack + /// tomStretchStack + /// tomSubscript + /// tomSubSup + /// tomSuperscript + /// tomUnderbar + /// tomUpperLimit + /// + /// + /// Type: long* + /// The inline object alignment, which can be one of these meanings depending on the inline object type: + /// + /// + /// Inline object type + /// Meaning of Align Parameter + /// + /// + /// tomRuby + /// tomRubyBelow tomRubyAlignCenter (default) tomRubyAlign010 tomRubyAlign121 tomRubyAlignLeft tomRubyAlignRight + /// + /// + /// tomBox + /// tomBoxAlignCenter tomSpaceMask tomSpaceDefault tomSpaceUnary tomSpaceBinary tomSpaceRelational tomSpaceSkip tomSpaceOrd tomSpaceDifferential tomSizeText tomSizeScript tomSizeScriptScript tomNoBreak tomTransparentForPositioning tomTransparentForSpacing + /// + /// + /// tomBoxedFormula + /// tomBoxHideTop tomBoxHideBottom tomBoxHideLeft tomBoxHideRight tomBoxStrikeH tomBoxStrikeV tomBoxStrikeTLBR tomBoxStrikeBLTR + /// + /// + /// tomBrackets + /// tomAlignDefault tomAlignCenter tomAlignMatchAscentDescent tomMathVariant + /// + /// + /// tomEquationArray + /// tomEqArrayLayoutWidth tomEqArrayAlignMask tomEqArrayAlignCenter tomEqArrayAlignTopRow tomEqArrayAlignBottomRow + /// + /// + /// tomMatrix + /// tomMatrixAlignMask tomMatrixAlignCenter tomMatrixAlignTopRow tomMatrixAlignBottomRow tomShowMatPlaceHldr + /// + /// + /// tomNary + /// tomLimitsDefault tomLimitsUnderOver tomLimitsSubSup tomUpperLimitAsSuperScript tomLimitsOpposite tomShowLLimPlaceHldr tomShowULimPlaceHldr tomDontGrowWithContent tomGrowWithContent + /// + /// + /// tomPhantom + /// tomPhantomShow tomPhantomZeroWidth tomPhantomZeroAscent tomPhantomZeroDescent tomPhantomTransparent + /// + /// + /// tomRadical + /// tomShowDegPlaceHldr + /// + /// + /// tomSubSup + /// tomSubSupAlign + /// + /// + /// tomStretchStack + /// tomStretchCharBelow tomStretchCharAbove tomStretchBaseBelow tomStretchBaseAbove + /// + /// + /// + /// + /// Type: long* + /// The inline object character. + /// The value for each object type is shown in the following table.. + /// + /// + /// Inline object type + /// Meaning of align parameter + /// + /// + /// tomAccent + /// Accent (U+0300—U+36F, U+20D0—U+20EF) + /// + /// + /// tomBoxedFormula + /// U+25AD for rectangle enclosure + /// + /// + /// tomBrackets + /// Opening bracket. Default: U+0028. + /// + /// + /// tomBracketsWithSeps + /// Opening bracket with separators. Default: U+0028 + /// + /// + /// tomEquationArray + /// U+2588 + /// + /// + /// tomFraction + /// Normal built-up fraction: U+002F; small numeric fraction: U+2298 + /// + /// + /// tomFunctionApply + /// U+2061 + /// + /// + /// tomLeftSubSup + /// U+005E + /// + /// + /// tomLowerLimit + /// U+252C + /// + /// + /// tomMatrix + /// U+25A0: no enclosing brackets U+24A8: enclosing parentheses (\pmatrix) U+24B1: enclosing vertical bars (\vmatrix) U+24A9: enclosing double vertical bars (\Vmatrix) + /// + /// + /// tomNary + /// n-ary symbol + /// + /// + /// tomOpChar + /// Internal use for no-build operators + /// + /// + /// tomOverbar + /// U+00AF + /// + /// + /// tomPhantom + /// U+27E1: full or custom phantom U+2B04: horizontal phantom U+21F3: vertical phantom U+2B06: ascent smash U+2B07: descent smash U+2B0C: horizontal smash U+2B0D: full smash + /// + /// + /// tomRadical + /// U+221A: square or nth root U+221B: cube root U+221C: fourth root + /// + /// + /// tomSlashedFraction + /// U+2044: skewed fraction U+2215: built-up linear fraction + /// + /// + /// tomStack + /// U+00A6 + /// + /// + /// tomStretchStack + /// Horizontal stretch character (see Unicode Technical Note 28 Appendix B for a list) + /// + /// + /// tomSubscript + /// U+005E + /// + /// + /// tomSubSup + /// U+005E + /// + /// + /// tomSuperscript + /// U+005F + /// + /// + /// tomUnderbar + /// U+2581 + /// + /// + /// tomUpperLimit + /// U+2534 + /// + /// + /// + /// + /// Type: long* + /// The closing tomBrackets character. See Unicode Technical Note 28 Appendix B. Character Keywords and Properties for a list. + /// + /// + /// Type: long* + /// The separator character for tomBracketsWithSep: + /// U+007C: vertical bar with no extra spacing + /// U+2223: vertical bar with extra spacing + /// + /// + /// Type: long* + /// The inline object count of arguments. + /// + /// + /// Type: long* + /// The inline object TeX style, which can be one of the following values. + /// + /// Note  The tomStyleDefault behavior depends on the context. + ///  + /// tomStyleDefault + /// tomStyleScriptScriptCramped + /// tomStyleScriptScript + /// tomStyleScriptCramped + /// tomStyleScript + /// tomStyleTextCramped + /// tomStyleText + /// tomStyleDisplayCramped + /// tomStyleDisplay + /// + /// + /// Type: long* + /// The inline object count of columns (tomMatrix only). + /// + /// + /// Type: long* + /// The inline object 0-based nesting level. + /// + /// + /// Unicode Technical Note 28 describes the alignment and character values in detail when the active end character is an inline object start delimiter. + /// When that character is not a start delimiter, the character and column parameters are set to 0, the count is set to the 0-based argument index, and the other parameters are set according to the active-end character properties of the innermost inline object argument. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getinlineobject + // HRESULT GetInlineObject( [out] long *pType, [out] long *pAlign, [out] long *pChar, [out] long *pChar1, [out] long *pChar2, [out] long *pCount, [out] long *pTeXStyle, [out] long *pcCol, [out] long *pLevel ); + int GetInlineObject(out tomConstants pType, out tomConstants pAlign, out int pChar, out int pChar1, out int pChar2, out int pCount, out tomConstants pTeXStyle, out int pcCol); - HRESULT GetProperty(int Type, out int pValue); + /// Gets the value of a property. + /// + /// Type: long + /// The property ID. + /// + /// + /// Type: long* + /// The property value. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getproperty + // HRESULT GetProperty( [in] long Type, [out] long *pValue ); + int GetProperty(int Type); - HRESULT GetRect(int Type, out int pLeft, out int pTop, out int pRight, out int pBottom, out int pHit); + /// Retrieves a rectangle of the specified type for the current range. + /// + /// Type: long + /// The type of rectangle to return. This parameter can include one value from each of the following tables. + /// tomAllowOffClient + /// tomClientCoord + /// tomObjectArg + /// tomTransform + /// Use one of these values to indicate the vertical position: + /// + /// + /// TA_TOP + /// Top edge of the bounding rectangle. + /// + /// + /// TA_BASELINE + /// Base line of the text. + /// + /// + /// TA_BOTTOM + /// Bottom edge of the bounding rectangle. + /// + /// + ///  + /// Use one of these values to indicate the horizontal position: + /// + /// + /// TA_LEFT + /// Left edge of the bounding rectangle. + /// + /// + /// TA_CENTER + /// Center of the bounding rectangle. + /// + /// + /// TA_RIGHT + /// Right edge of the bounding rectangle. + /// + /// + /// + /// + /// Type: long* + /// The left rectangle coordinate. + /// + /// + /// Type: long* + /// The top rectangle coordinate. + /// + /// + /// Type: long* + /// The right rectangle coordinate. + /// + /// + /// Type: long* + /// The bottom rectangle coordinate. + /// + /// + /// Type: long* + /// The hit-test value for the range. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getrect + // HRESULT GetRect( [in] long Type, [out] long *pLeft, [out] long *pTop, [out] long *pRight, [out] long *pBottom, [out] long *pHit ); + tomConstants GetRect(tomConstants Type, out int pLeft, out int pTop, out int pRight, out int pBottom); - HRESULT GetSubrange(int iSubrange, out int pcpFirst, out int pcpLim); + /// Retrieves a subrange in a range. + /// + /// Type: long + /// The subrange index. + /// + /// + /// Type: long* + /// The character position for the start of the subrange. + /// + /// + /// Type: long* + /// The character position for the end of the subrange. + /// + /// + /// Subranges are selected as follows. + /// + /// + /// iSubrange value + /// Subrange + /// + /// + /// Equals zero + /// Gets the current active subrange. + /// + /// + /// Greater than zero + /// Gets the subrange at the index specified by iSubrange, in the order in which the subranges were added. This requires extra calculation. + /// + /// + /// Less than zero + /// Gets the subrange at the index specified by iSubrange, in increasing character position order. + /// + /// + ///  + /// See ITextRange2::GetCount for the count of subranges not including the active subrange. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getsubrange + // HRESULT GetSubrange( [in] long iSubrange, [out] long *pcpFirst, [out] long *pcpLim ); + void GetSubrange(int iSubrange, out int pcpFirst, out int pcpLim); - HRESULT GetText2(int Flags, [MarshalAs(UnmanagedType.BStr)] out string pbstr); + /// Gets the text in this range according to the specified conversion flags. + /// + /// Type: long + /// The flags controlling how the text is retrieved. The flags can include a combination of the following values. Specifying a Flags value of 0 is the same as calling the ITextRange::GetText method. + /// tomAdjustCRLF + /// tomUseCRLF + /// tomIncludeNumbering + /// tomNoHidden + /// tomNoMathZoneBrackets + /// tomTextize + /// tomAllowFinalEOP + /// tomTranslateTableCell + /// tomFoldMathAlpha + /// tomLanguageTag + /// + /// + /// Type: BSTR* + /// The text in the range. + /// + /// This method includes the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry standard language tag which may be preferable to the language code identifier (LCID) obtained by calling ITextFont::GetLanguageID. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-gettext2 + // HRESULT GetText2( [in] long Flags, [out] BSTR *pbstr ); + void GetText2(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] out string pbstr); - HRESULT HexToUnicode(); + /// Converts and replaces the hexadecimal number at the end of this range to a Unicode character. + /// + /// Some Unicode surrogates for hex values from 0x10000 up to 0x10FFFF are for internal use: + /// + /// + /// Hex values + /// Available for use + /// + /// + /// 7, 0xFDD0 — 0xFDEF, 0xFFF9 — 0xFFFF + /// Internal use only + /// + /// + /// 0xA — 0xD in the C0 range (0-0x1F) + /// Available for use + /// + /// + /// C1 range (0x80 — 0x9F) + /// Internal use only + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-hextounicode + // HRESULT HexToUnicode(); + void HexToUnicode(); - HRESULT InsertTable(int cCol, int cRow, int AutoFit); + /// Inserts a table in a range. + /// + /// Type: long + /// The number of columns in the table. + /// + /// + /// Type: long + /// The number of rows in the table. + /// + /// + /// Type: long + /// Specifies how the cells fit the target space. + /// + /// If the range is nondegenerate, the table replaces the text in the range. The column widths are calculated according to the AutoFit parameter, and the borders are solid black with 0.5 point widths. To change these defaults, use the ITextRange2::GetRow method to obtain an ITextRow interface. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-inserttable + // HRESULT InsertTable( [in] long cCol, [in] long cRow, [in] long AutoFit ); + void InsertTable(int cCol, int cRow, int AutoFit); - HRESULT Linearize(int Flags); + /// Translates the built-up math, ruby, and other inline objects in this range to linearized form. + /// + /// Type: long + /// A combination of the following flags. + /// tomMathAlphabetics + /// tomMathBuildDownOutermost + /// tomMathBuildUpArgOrZone + /// tomMathRemoveOutermost + /// tomPlain + /// tomTeX + /// + /// + /// If the linearization is successful, the originally selected range is replaced by the linearized version. + /// If the tomMathRemoveOutermost or tomMathBuildDownOutermost build down mode is specified, the build down operation can be affected by the tomMathChangeMask values. + /// The main purpose of these build-down modes is to facilitate transformations of the build-up math object as exposed by math context menus. + /// For example, to convert a stacked fraction to a linear fraction as in (a+b/c)/(u+x/y)→((a+b/c))⁄((u+x/y)), parentheses must be inserted; otherwise, you get a transformation that looks incorrect, as in (a+b/c)/(u+x/y)→(a+b/c)⁄(u+x/y), even though internally the linear fraction still has the original numerator and denominator. + /// The build-down process automatically inserts the parentheses, because the linear format for this case has parentheses, and the special change is made to replace the stacked-fraction operator U+002F by the linear fraction operator U+2215. Build up doesn't discard the parentheses for U+2215, but it does for U+002F. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-linearize + // HRESULT Linearize( [in] long Flags ); + void Linearize(tomConstants Flags); - HRESULT SetActiveSubrange(int cpAnchor, int cpActive); + /// Makes the specified subrange the active subrange of this range. + /// + /// Type: long + /// The anchor end character position of the subrange to make active. + /// + /// + /// Type: long + /// The active end character position of the subrange to make active. + /// + /// The active subrange is the one affected by operations such as Shift+Arrow keys if this range is the selection. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setactivesubrange + // HRESULT SetActiveSubrange( [in] long cpAnchor, [in] long cpActive ); + void SetActiveSubrange(int cpAnchor, int cpActive); - HRESULT SetDropCap(int cLine, int Position); + /// + /// Not implemented. + /// Sets the drop-cap parameters for the paragraph that contains the current range. + /// + /// + /// Type: long + /// The count of lines for drop cap. Zero means no drop cap. + /// + /// + /// Type: long + /// The position of drop cap. It can be one of the following. + /// + /// + /// The current range can be degenerate, or you can select up to the complete drop-cap paragraph. If the range contains more than one paragraph, this method returns E_FAIL. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setdropcap + // HRESULT SetDropCap( [in] long cLine, [in] long Position ); + void SetDropCap(int cLine, int Position); - HRESULT SetProperty(int Type, int Value); + /// Sets the value of the specified property. + /// + /// Type: long + /// The ID of the property to set. + /// + /// + /// Type: long + /// The new property value. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setproperty + // HRESULT SetProperty( [in] long Type, [in] long Value ); + void SetProperty(tomConstants Type, int Value); - HRESULT SetText2(int Flags, [MarshalAs(UnmanagedType.BStr)] string bstr); + /// Sets the text of this range. + /// + /// Type: long + /// Flags controlling how the text is inserted in the range. The flag can be one of the following values: + /// tomUnicodeBiDi + /// tomMathCFCheck + /// tomUnlink + /// tomUnhide + /// tomCheckTextLimit + /// tomLanguageTag + /// + /// + /// Type: BSTR + /// The new text. + /// + /// + /// If the bstr parameter is NULL, the text in the range is deleted. + /// This method is similar to ITextRange:: SetText, but lets the client specify flags that control various insertion options, including the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry standard language tag that may be preferable to ITextFont::SetLanguageID, which uses a language code identifier (LCID). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-settext2 + // HRESULT SetText2( [in] long Flags, [in] BSTR bstr ); + void SetText2(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] string bstr); - HRESULT UnicodeToHex(); + /// Converts the Unicode character(s) preceding the start position of this text range to a hexadecimal number, and selects it. + /// + /// Some Unicode surrogates for hex values from 0x10000 up to 0x10FFFF are for internal use: + /// + /// + /// Hex values + /// Available for use + /// + /// + /// 0xFDD0 – 0xFDEF, 0xFFF9-0xFFFF + /// Internal use only + /// + /// + /// 0xA – 0xD in the C0 range (0-0x1F) + /// Available for use + /// + /// + /// C1 range (0x80 – 0x9F) + /// Internal use only + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-unicodetohex + // HRESULT UnicodeToHex(); + void UnicodeToHex(); - HRESULT SetInlineObject(int Type, int Align, int Char, int Char1, int Char2, int Count, int TeXStyle, int cCol); + /// Sets or inserts the properties of an inline object for a degenerate range. + /// + /// Type: long + /// The object type as defined in ITextRange2::GetInlineObject. + /// + /// + /// Type: long + /// The object alignment as defined in ITextRange2::GetInlineObject. + /// + /// + /// Type: long + /// The object character as defined in ITextRange2::GetInlineObject. + /// + /// + /// Type: long + /// The closing bracket (tomBrackets) character. See Unicode Technical Note 28 for a list of characters. + /// + /// + /// Type: long + /// The separator character for tomBracketsWithSeps, which can be one of the following values. + /// + /// + /// Type: long + /// The number of arguments in the inline object. + /// + /// + /// Type: long + /// The TeX style, as defined in ITextRange2::GetInlineObject. + /// + /// + /// Type: long + /// The number of columns in the inline object. For tomMatrix only. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setinlineobject + // HRESULT SetInlineObject( [in] long Type, [in] long Align, [in] long Char, [in] long Char1, [in] long Char2, [in] long Count, [in] long TeXStyle, [in] long cCol ); + void SetInlineObject(tomConstants Type, tomConstants Align, int Char, int Char1, int Char2, int Count, tomConstants TeXStyle, int cCol); - HRESULT GetMathFunctionType([MarshalAs(UnmanagedType.BStr)] string bstr, out int pValue); + /// Retrieves the math function type associated with the specified math function name. + /// + /// Type: BSTR + /// The math function name that is checked to determine the math function type. + /// + /// + /// Type: long* + /// The math function type of the function name specified by bstr. It can be one of the following values. + /// tomFunctionTypeNone + /// tomFunctionTypeTakesArg + /// tomFunctionTypeTakesLim + /// tomFunctionTypeTakesLim2 + /// tomFunctionTypeIsLim + /// + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getmathfunctiontype + // HRESULT GetMathFunctionType( [in] BSTR bstr, [out] long *pValue ); + tomConstants GetMathFunctionType([MarshalAs(UnmanagedType.BStr)] string bstr); - HRESULT InsertImage(int width, int height, int ascent, int Type, [MarshalAs(UnmanagedType.BStr)] string bstrAltText, [In, Optional] IStream? pStream); + /// Inserts an image into this range. + /// + /// Type: long + /// The width, in HIMETRIC units (0.01 mm), of the image. + /// + /// + /// Type: long + /// The height, in HIMETRIC units, of the image. + /// + /// + /// Type: long + /// If Type is TA_BASELINE, this parameter is the distance, in HIMETRIC units, that the top of the image extends above the text baseline. If Type is TA_BASELINE and ascent is zero, the bottom of the image is placed at the text baseline. + /// + /// + /// Type: long + /// The vertical alignment of the image. It can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// TA_BASELINE + /// Align the image relative to the text baseline. + /// + /// + /// TA_BOTTOM + /// Align the bottom of the image at the bottom of the text line. + /// + /// + /// TA_TOP + /// Align the top of the image at the top of the text line + /// + /// + /// + /// + /// Type: BSTR + /// The alternate text for the image. + /// + /// + /// Type: IStream + /// The stream that contains the image data. + /// + /// + /// Type: HRESULT + /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// If the range is nondegenerate, the image replaces the text in the range. + // https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-insertimage + // HRESULT InsertImage( [in] long width, [in] long height, [in] long ascent, [in] long Type, [in] BSTR bstrAltText, [in] IStream *pStream ); + void InsertImage(int width, int height, int ascent, Gdi32.TextAlign Type, [MarshalAs(UnmanagedType.BStr)] string? bstrAltText, + [In, Optional] System.Runtime.InteropServices.ComTypes.IStream? pStream); } /// The ITextRow interface provides methods to insert one or more identical table rows, and to retrieve and change table row properties. To insert nonidentical rows, call ITextRow::Insert for each different row configuration. @@ -8998,7 +14430,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrow [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRow")] - [ComImport, Guid("C241F5EF-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5EF-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextRow { int GetAlignment(); @@ -9071,9 +14503,9 @@ public static partial class MsftEdit HRESULT SetCellWidth(int Value); - HRESULT GetCellBorderColors(out int pcrLeft, out int pcrTop, out int pcrRight, out int pcrBottom); + tomConstants GetCellBorderColors(out int pcrLeft, out int pcrTop, out int pcrRight); - HRESULT GetCellBorderWidths(out int pduLeft, out int pduTop, out int pduRight, out int pduBottom); + tomConstants GetCellBorderWidths(out int pduLeft, out int pduTop, out int pduRight); HRESULT SetCellBorderColors(int crLeft, int crTop, int crRight, int crBottom); @@ -9083,11 +14515,11 @@ public static partial class MsftEdit HRESULT CanChange(out int pValue); - HRESULT GetProperty(int Type, out int pValue); + tomConstants GetProperty(int Type); HRESULT Insert(int cRow); - HRESULT IsEqual([In, Optional] ITextRow? pRow, out int pB); + tomConstants IsEqual([In, Optional] ITextRow? pRow); HRESULT Reset(int Value); @@ -9161,7 +14593,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextselection [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextSelection")] - [ComImport, Guid("8CC497C1-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("8CC497C1-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)] public interface ITextSelection : ITextRange { @@ -9172,17 +14604,17 @@ public static partial class MsftEdit int GetType(); - HRESULT MoveLeft(int Unit, int Count, int Extend, out int pDelta); + tomConstants MoveLeft(int Unit, int Count, int Extend); - HRESULT MoveRight(int Unit, int Count, int Extend, out int pDelta); + tomConstants MoveRight(int Unit, int Count, int Extend); - HRESULT MoveUp(int Unit, int Count, int Extend, out int pDelta); + tomConstants MoveUp(int Unit, int Count, int Extend); - HRESULT MoveDown(int Unit, int Count, int Extend, out int pDelta); + tomConstants MoveDown(int Unit, int Count, int Extend); - HRESULT HomeKey(int Unit, int Extend, out int pDelta); + tomConstants HomeKey(int Unit, int Extend); - HRESULT EndKey(int Unit, int Extend, out int pDelta); + tomConstants EndKey(int Unit, int Extend); HRESULT TypeText([MarshalAs(UnmanagedType.BStr)] string bstr); } @@ -9190,7 +14622,7 @@ public static partial class MsftEdit /// Currently, this interface contains no methods other than those inherited from ITextRange2. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextselection2 [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextSelection2")] - [ComImport, Guid("C241F5E1-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5E1-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextSelection2 : ITextRange2 { } @@ -9230,7 +14662,7 @@ public static partial class MsftEdit HRESULT SetType(int Value); - HRESULT GetProperty(int Type, out int pValue); + tomConstants GetProperty(int Type); HRESULT GetRange(int cpActive, int cpAnchor, out ITextRange2 ppRange); @@ -9247,7 +14679,7 @@ public static partial class MsftEdit /// You get a pointer to an ITextStoryRanges collection by calling the GetStoryRanges method. Each story obtained from this collection is represented by an ITextRange object that covers the whole story. Text Object Model (TOM) engines that only have a single story do not need to implement an ITextStoryRanges interface. Your code should only get a stories collection if GetStoryCount returns a story count greater than one. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstoryranges [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStoryRanges")] - [ComImport, Guid("8CC497C5-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("8CC497C5-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)] public interface ITextStoryRanges { HRESULT NewEnum([MarshalAs(UnmanagedType.IUnknown)] out object ppunkEnum); @@ -9264,7 +14696,7 @@ public static partial class MsftEdit /// // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstoryranges2 [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStoryRanges2")] - [ComImport, Guid("C241F5E5-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5E5-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextStoryRanges2 : ITextStoryRanges { HRESULT Item2(int Index, out ITextRange2 ppRange); @@ -9273,7 +14705,7 @@ public static partial class MsftEdit /// The ITextStrings interface represents a collection of rich-text strings that are useful for manipulating rich text. In particular, you can use the collection to convert linearly formatted math expressions into built-up form and vice versa. You can also use the collection to collect the concatenation of a set of rich-text strings, or to manipulate a string without changing a primary story. The collection is efficiently implemented by concatenating the strings in a scratch story and maintaining an array of the string counts that identify the strings. // https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstrings [PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStrings")] - [ComImport, Guid("C241F5E7-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] + [ComImport, Guid("C241F5E7-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)] public interface ITextStrings { HRESULT Item(int Index, out ITextRange2 ppRange); @@ -9293,7 +14725,7 @@ public static partial class MsftEdit HRESULT EncodeFunction(int Type, int Align, int Char, int Char1, int Char2, int Count, int TeXStyle, int cCol, [In, Optional] ITextRange2? pRange); - HRESULT GetCch(int iString, out int pcch); + tomConstants GetCch(int iString); HRESULT InsertNullStr(int iString); diff --git a/PInvoke/MsftEdit/TextServ.cs b/PInvoke/MsftEdit/TextServ.cs index fbd3ac80..f7ba170d 100644 --- a/PInvoke/MsftEdit/TextServ.cs +++ b/PInvoke/MsftEdit/TextServ.cs @@ -3,6 +3,7 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using static Vanara.PInvoke.Imm32; using static Vanara.PInvoke.Ole32; +using static Vanara.PInvoke.UIAutomationCore; using static Vanara.PInvoke.User32; namespace Vanara.PInvoke; diff --git a/PInvoke/MsftEdit/Vanara.PInvoke.MsftEdit.csproj b/PInvoke/MsftEdit/Vanara.PInvoke.MsftEdit.csproj index 07102f22..ce7107c9 100644 --- a/PInvoke/MsftEdit/Vanara.PInvoke.MsftEdit.csproj +++ b/PInvoke/MsftEdit/Vanara.PInvoke.MsftEdit.csproj @@ -15,8 +15,9 @@ - + + \ No newline at end of file diff --git a/PInvoke/UIAutomation/UIAutomationClient.cs b/PInvoke/UIAutomation/UIAutomationClient.cs new file mode 100644 index 00000000..84e57908 --- /dev/null +++ b/PInvoke/UIAutomation/UIAutomationClient.cs @@ -0,0 +1,2222 @@ +namespace Vanara.PInvoke; + +public static partial class UIAutomationClient +{ + /// Describes the named constants used to identify Microsoft UI Automation events. + [PInvokeData("UIAutomationClient.h")] + public enum EVENTID + { + /// + /// Identifies the event that is raised when the active text position changes, indicated by a navigation event within or between + /// read-only text elements (such as web browsers, PDF documents, or EPUB documents) using bookmarks (fragment identifiers that refer + /// to a location within a resource). + /// + UIA_ActiveTextPositionChangedEventId = 20036, + + /// + /// Identifies the event that is raised when asynchronous content is being loaded. This event is used mainly by providers to indicate + /// that asynchronous content-loading events have occurred. + /// + UIA_AsyncContentLoadedEventId = 20006, + + /// Identifies the event that is raised when the focus has changed from one element to another. + UIA_AutomationFocusChangedEventId = 20005, + + /// Identifies the event that is raised when the value of a property has changed. + UIA_AutomationPropertyChangedEventId = 20004, + + /// Identifies the event that is raised when a provider calls the UiaRaiseChangesEvent function. + UIA_ChangesEventId = 20034, + + /// + /// Identifies the event that is raised when the user ends a drag operation before dropping an element on a drop target. This event + /// is raised by the element being dragged. Supported starting with Windows 8. + /// + UIA_Drag_DragCancelEventId = 20027, + + /// + /// Identifies the event that is raised when the user drops an element on a drop target. This event is raised by the element being + /// dragged. Supported starting with Windows 8. + /// + UIA_Drag_DragCompleteEventId = 20028, + + /// + /// Identifies the event that is raised when the user starts to drag an element. This event is raised by the element being dragged. + /// Supported starting with Windows 8. + /// + UIA_Drag_DragStartEventId = 20026, + + /// + /// Identifies the event that is raised when the user drags an element into a drop target's boundary. This event is raised by the + /// drop target element. Supported starting with Windows 8. + /// + UIA_DropTarget_DragEnterEventId = 20029, + + /// + /// Identifies the event that is raised when the user drags an element out of a drop target's boundary. This event is raised by the + /// drop target element. Supported starting with Windows 8. + /// + UIA_DropTarget_DragLeaveEventId = 20030, + + /// + /// Identifies the event that is raised when the user drops an element on a drop target. This event is raised by the drop target + /// element. Supported starting with Windows 8. + /// + UIA_DropTarget_DroppedEventId = 20031, + + /// + /// Identifies the event that is raised when a change is made to the root node of a UI Automation fragment that is hosted in another + /// element. Supported starting with Windows 8. + /// + UIA_HostedFragmentRootsInvalidatedEventId = 20025, + + /// Identifies the event that is raised when the specified input was discarded or otherwise failed to reach any element. + UIA_InputDiscardedEventId = 20022, + + /// + /// Identifies the event that is raised when the specified input reached an element other than the element for which the + /// StartListening method was called. + /// + UIA_InputReachedOtherElementEventId = 20021, + + /// + /// Identifies the event that is raised when the specified mouse or keyboard input reaches the element for which the StartListening + /// method was called. + /// + UIA_InputReachedTargetEventId = 20020, + + /// Identifies the event that is raised when a control is invoked or activated. + UIA_Invoke_InvokedEventId = 20009, + + /// + /// Identifies the event that is raised when the layout of child items within a control has changed. This event is also used for + /// Auto-suggest accessibility. + /// + UIA_LayoutInvalidatedEventId = 20008, + + /// + /// Identifies the event that is raised when the content of a live region has changed. Supported starting with Windows 8. + /// + UIA_LiveRegionChangedEventId = 20024, + + /// Identifies the event that is raised when a menu is closed. + UIA_MenuClosedEventId = 20007, + + /// Identifies the event that is raised when a menu mode is ended. + UIA_MenuModeEndEventId = 20019, + + /// Identifies the event that is raised when a menu mode is started. + UIA_MenuModeStartEventId = 20018, + + /// Identifies the event that is raised when a menu is opened. + UIA_MenuOpenedEventId = 20003, + + /// Identifies the event that is raised when a provider calls the UiaRaiseNotificationEvent method. + UIA_NotificationEventId = 20035, + + /// Identifies the event that is raised when a selection in a container has changed significantly. + UIA_Selection_InvalidatedEventId = 20013, + + /// Identifies the event raised when an item is added to a collection of selected items. + UIA_SelectionItem_ElementAddedToSelectionEventId = 20010, + + /// Identifies the event raised when an item is removed from a collection of selected items. + UIA_SelectionItem_ElementRemovedFromSelectionEventId = 20011, + + /// + /// Identifies the event that is raised when a call to the Select, AddToSelection, or RemoveFromSelection method results in a single + /// item being selected. + /// + UIA_SelectionItem_ElementSelectedEventId = 20012, + + /// Identifies the event that is raised when the UI Automation tree structure is changed. + UIA_StructureChangedEventId = 20002, + + /// Identifies the event that is raised when a provider issues a system alert. Supported starting with Windows 8. + UIA_SystemAlertEventId = 20023, + + /// Identifies the event that is raised whenever textual content is modified. + UIA_Text_TextChangedEventId = 20015, + + /// Identifies the event that is raised when the text selection is modified. + UIA_Text_TextSelectionChangedEventId = 20014, + + /// + /// Identifies the event that is raised whenever a composition replacement is performed by a control. Supported starting with Windows 8.1. + /// + UIA_TextEdit_ConversionTargetChangedEventId = 20033, + + /// + /// Identifies the event that is raised whenever text auto-correction is performed by a control. Supported starting with Windows 8.1. + /// + UIA_TextEdit_TextChangedEventId = 20032, + + /// Identifies the event that is raised when a tooltip is closed. + UIA_ToolTipClosedEventId = 20001, + + /// Identifies the event that is raised when a tooltip is opened. + UIA_ToolTipOpenedEventId = 20000, + + /// Identifies the event that is raised when a window is closed. + UIA_Window_WindowClosedEventId = 20017, + + /// Identifies the event that is raised when a window is opened. + UIA_Window_WindowOpenedEventId = 20016, + } + + /// Describes the named constants, which are used to identify metadata types in a document. + [PInvokeData("UIAutomationClient.h")] + public enum METADATAID + { + /// + /// Identifies metadata which indicates how a string should be interpreted and spoken by a screen reader or text-to-speech engine. + /// + UIA_SayAsInterpretAsMetadataId = 100000, + } + + /// Describes the named constants that identify Microsoft UI Automation control patterns. + // https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-controlpattern-ids + [PInvokeData("UIAutomationClient.h")] + public enum PATTERNID + { + /// Identifies the Annotation control pattern. Supported starting with Windows 8. + UIA_AnnotationPatternId = 10023, + + /// Identifies the CustomNavigation control pattern. Supported starting with Windows 10. + UIA_CustomNavigationPatternId = 10033, + + /// Identifies the Dock control pattern. + UIA_DockPatternId = 10011, + + /// Identifies the Drag control pattern. Supported starting with Windows 8. + UIA_DragPatternId = 10030, + + /// Identifies the DropTarget control pattern. Supported starting with Windows 8. + UIA_DropTargetPatternId = 10031, + + /// Identifies the ExpandCollapse control pattern. + UIA_ExpandCollapsePatternId = 10005, + + /// Identifies the GridItem control pattern. + UIA_GridItemPatternId = 10007, + + /// Identifies the Grid control pattern. + UIA_GridPatternId = 10006, + + /// Identifies the Invoke control pattern. + UIA_InvokePatternId = 10000, + + /// Identifies the ItemContainer control pattern. + UIA_ItemContainerPatternId = 10019, + + /// Identifies the LegacyIAccessible control pattern. + UIA_LegacyIAccessiblePatternId = 10018, + + /// Identifies the MultipleView control pattern. + UIA_MultipleViewPatternId = 10008, + + /// Identifies the ObjectModel control pattern. Supported starting with Windows 8. + UIA_ObjectModelPatternId = 10022, + + /// Identifies the RangeValue control pattern. + UIA_RangeValuePatternId = 10003, + + /// Identifies the ScrollItem control pattern. + UIA_ScrollItemPatternId = 10017, + + /// Identifies the Scroll control pattern. + UIA_ScrollPatternId = 10004, + + /// Identifies the SelectionItem control pattern. + UIA_SelectionItemPatternId = 10010, + + /// Identifies the Selection control pattern. + UIA_SelectionPatternId = 10001, + + /// Identifies the Spreadsheet control pattern. Supported starting with Windows 8. + UIA_SpreadsheetPatternId = 10026, + + /// Identifies the SpreadsheetItem control pattern. Supported starting with Windows 8. + UIA_SpreadsheetItemPatternId = 10027, + + /// Identifies the Styles control pattern. Supported starting with Windows 8. + UIA_StylesPatternId = 10025, + + /// Identifies the SynchronizedInput control pattern. + UIA_SynchronizedInputPatternId = 10021, + + /// Identifies the TableItem control pattern. + UIA_TableItemPatternId = 10013, + + /// Identifies the Table control pattern. + UIA_TablePatternId = 10012, + + /// Identifies the TextChild control pattern. Supported starting with Windows 8. + UIA_TextChildPatternId = 10029, + + /// Identifies the TextEdit control pattern. Supported starting with Windows 8.1. + UIA_TextEditPatternId = 10032, + + /// Identifies the Text control pattern. + UIA_TextPatternId = 10014, + + /// Identifies the second version of the Text control pattern. Supported starting with Windows 8. + UIA_TextPattern2Id = 10024, + + /// Identifies the Toggle control pattern. + UIA_TogglePatternId = 10015, + + /// Identifies the Transform control pattern. + UIA_TransformPatternId = 10016, + + /// Identifies the second version of the Transform control pattern. Supported starting with Windows 8. + UIA_TransformPattern2Id = 10028, + + /// Identifies the Value control pattern. + UIA_ValuePatternId = 10002, + + /// Identifies the VirtualizedItem control pattern. + UIA_VirtualizedItemPatternId = 10020, + + /// Identifies the Window control pattern. + UIA_WindowPatternId = 10009, + } + + /// Describes the named constants that identify the properties of Microsoft UI Automation elements. + [PInvokeData("UIAutomationClient.h")] + public enum PROPERTYID + { + /// + /// Identifies the AcceleratorKey property, which is a string containing the accelerator key (also called shortcut key) combinations + /// for the automation element. + /// + /// Shortcut key combinations invoke an action. For example, CTRL+O is often used to invoke the Open file common dialog box. An + /// automation element that has the AcceleratorKey property can implement the Invoke control pattern for the action that is + /// equivalent to the shortcut command. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AcceleratorKeyPropertyId = 30006, + + /// + /// Identifies the AccessKey property, which is a string containing the access key character for the automation element. + /// + /// An access key (sometimes called a mnemonic) is a character in the text of a menu, menu item, or label of a control such as a + /// button, that activates the associated menu function. For example, to open the File menu, for which the access key is typically F, + /// the user would press ALT+F. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AccessKeyPropertyId = 30007, + + /// + /// Identifies the AnnotationObjects property, which is a list of annotation objects in a document, such as comment, header, footer, + /// and so on. + /// Variant type: VT_I4 | VT_ARRAY + /// Default value: empty array + /// + UIA_AnnotationObjectsPropertyId = 30156, + + /// + /// Identifies the AnnotationTypes property, which is a list of the types of annotations in a document, such as comment, header, + /// footer, and so on. + /// Variant type: VT_I4 | VT_ARRAY + /// Default value: empty array + /// + UIA_AnnotationTypesPropertyId = 30155, + + /// + /// Identifies the AriaProperties property, which is a formatted string containing the Accessible Rich Internet Application (ARIA) + /// property information for the automation element. For more information about mapping ARIA states and properties to UI Automation + /// properties and functions, see UI Automation for W3C Accessible Rich Internet Applications Specification. + /// + /// AriaProperties is a collection of Name/Value pairs with delimiters of = (equals) and ; (semicolon), for example, + /// "checked=true;disabled=false". The \ (backslash) is used as an escape character when these delimiter characters or \ appear in + /// the values. For security and other reasons, the provider implementation of this property can take steps to validate the original + /// ARIA properties; however, it is not required. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AriaPropertiesPropertyId = 30102, + + /// + /// Identifies the AriaRole property, which is a string containing the Accessible Rich Internet Application (ARIA) role information + /// for the automation element. For more information about mapping ARIA roles to UI Automation control types, see UI Automation for + /// W3C Accessible Rich Internet Applications Specification. + /// [!Note] + /// + /// As an option, the user agent can also offer a localized description of the W3C ARIA role in the LocalizedControlType property. + /// When the localized string is not specified, the system will provide the default LocalizedControlType string for the element. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AriaRolePropertyId = 30101, + + /// + /// Identifies the AutomationId property, which is a string containing the UI Automation identifier (ID) for the automation element. + /// + /// When it is available, the AutomationId of an element must be the same in any instance of the application, regardless of the local + /// language. The value should be unique among sibling elements, but not necessarily unique across the entire desktop. For example, + /// multiple instances of an application, or multiple folder views in Microsoft Windows Explorer, can contain elements with the same + /// AutomationId property, such as "SystemMenuBar". + /// + /// + /// Although support for AutomationId is always recommended for better automated testing support, this property is not mandatory. + /// Where it is supported, AutomationId is useful for creating a test automation script that runs regardless of the UI language. + /// Clients should make no assumptions regarding the AutomationId values exposed by other applications. AutomationId is not + /// guaranteed to be stable across different releases or builds of an application. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AutomationIdPropertyId = 30011, + + /// + /// Identifies the BoundingRectangle property, which specifies the coordinates of the rectangle that completely encloses the + /// automation element. The rectangle is expressed in physical screen coordinates. It can contain points that are not clickable if + /// the shape or clickable region of the UI item is irregular, or if the item is obscured by other UI elements. + /// Variant type: VT_R8 | VT_ARRAY + /// Default value: [0,0,0,0] + /// [!Note] + /// This property is NULL if the item is not currently displaying a UI. + /// + UIA_BoundingRectanglePropertyId = 30001, + + /// + /// Identifies the CenterPoint property, which specifies the center X and Y point coordinates of the automation element. The + /// coordinate space is what the provider logically considers a page. + /// Variant type: VT_R8 | VT_ARRAY + /// Default value: VT_EMPTY + /// + UIA_CenterPointPropertyId = 30165, + + /// + /// Identifies the ClassName property, which is a string containing the class name for the automation element as assigned by the + /// control developer. + /// + /// The class name depends on the implementation of the UI Automation provider and therefore is not always in a standard format. + /// However, if the class name is known, it can be used to verify that an application is working with the expected automation element. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_ClassNamePropertyId = 30012, + + /// + /// Identifies the ClickablePoint property, which is a point on the automation element that can be clicked. An element cannot be + /// clicked if it is completely or partially obscured by another window. + /// Variant type: VT_R8 | VT_ARRAY + /// Default value: VT_EMPTY + /// + UIA_ClickablePointPropertyId = 30014, + + /// + /// Identifies the ControllerFor property, which is an array of automation elements that are manipulated by the automation element + /// that supports this property. + /// + /// ControllerFor is used when an automation element affects one or more segments of the application UI or the desktop; otherwise, it + /// is hard to associate the impact of the control operation with UI elements. + /// + /// This identifier is commonly used for Auto-suggest accessibility. + /// Variant type for providers: VT_UNKNOWN | VT_ARRAY + /// Variant type for clients: VT_UNKNOWN (IUIAutomationElementArray ) + /// Default value: empty array + /// + UIA_ControllerForPropertyId = 30104, + + /// + /// Identifies the ControlType property, which is a class that identifies the type of the automation element. ControlType defines + /// characteristics of the UI elements by well known UI control primitives such as button or check box. + /// Variant type: VT_I4 + /// Default value: UIA_CustomControlTypeId + /// [!Note] + /// Use the default value only if the automation element represents a completely new type of control. + /// + UIA_ControlTypePropertyId = 30003, + + /// + /// Identifies the Culture property, which contains a locale identifier for the automation element (for example, 0x0409 for "en-US" + /// or English (United States)). + /// + /// Each locale has a unique identifier, a 32-bit value that consists of a language identifier and a sort order identifier. The + /// locale identifier is a standard international numeric abbreviation and has the components necessary to uniquely identify one of + /// the installed operating system-defined locales. For more information, see Language Identifier Constants and Strings. + /// + /// This property may exist on a per-control basis, but typically is only available on an application level. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_CulturePropertyId = 30015, + + /// + /// Identifies the DescribedBy property, which is an array of elements that provide more information about the automation element. + /// + /// DescribedBy is used when an automation element is explained by another segment of the application UI. For example, the property + /// can point to a text element of "2,529 items in 85 groups, 10 items selected" from a complex custom list object. Instead of using + /// the object model for clients to digest similar information, the DescribedBy property can offer quick access to the UI element + /// that may already offer useful end-user information that describes the UI element. + /// + /// Variant type for providers: VT_UNKNOWN | VT_ARRAY + /// Variant type for clients: VT_UNKNOWN (IUIAutomationElementArray) + /// Default value: empty array + /// + UIA_DescribedByPropertyId = 30105, + + /// + /// Identifies the FillColor property, which specifies the color used to fill the automation element. This attribute is specified as + /// a COLORREF, a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_FillColorPropertyId = 30160, + + /// + /// Identifies the FillType property, which specifies the pattern used to fill the automation element, such as none, color, gradient, + /// picture, pattern, and so on. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_FillTypePropertyId = 30162, + + /// + /// Identifies the FlowsFrom property, which is an array of automation elements that suggests the reading order before the current + /// automation element. Supported starting with Windows 8. + /// + /// The FlowsFrom property specifies the reading order when automation elements are not exposed or structured in the same reading + /// order as perceived by the user. While the FlowsFrom property can specify multiple preceding elements, it typically contains only + /// the prior element in the reading order. + /// + /// Variant type for providers: VT_UNKNOWN | VT_ARRAY + /// Variant type for clients: VT_UNKNOWN (IUIAutomationElementArray) + /// Default value: empty array + /// + UIA_FlowsFromPropertyId = 30148, + + /// + /// Identifies the FlowsTo property, which is an array of automation elements that suggests the reading order after the current + /// automation element. + /// + /// The FlowsTo property specifies the reading order when automation elements are not exposed or structured in the same reading order + /// as perceived by the user. While the FlowsTo property can specify multiple succeeding elements, it typically contains only the + /// next element in the reading order. + /// + /// Variant type for providers: VT_UNKNOWN | VT_ARRAY + /// Variant type for clients: VT_UNKNOWN (IUIAutomationElementArray) + /// Default value: empty array + /// + UIA_FlowsToPropertyId = 30106, + + /// + /// Identifies the FrameworkId property, which is a string containing the name of the underlying UI framework that the automation + /// element belongs to. + /// + /// The FrameworkId enables client applications to process automation elements differently depending on the particular UI framework. + /// Examples of property values include "Win32", "WinForm", and "DirectUI". + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_FrameworkIdPropertyId = 30024, + + /// + /// The FullDescription property exposes a localized string which can contain extended description text for an element. + /// FullDescription can contain a more complete description of an element than may be appropriate for the element Name. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_FullDescriptionPropertyId = 30159, + + /// + /// Identifies the HasKeyboardFocus property, which is a Boolean value that indicates whether the automation element has keyboard focus. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_HasKeyboardFocusPropertyId = 30008, + + /// + /// Identifies the HeadingLevel property, which indicates the heading level of a UI Automation element. + /// Variant type: VT_I4 + /// Default value: HeadingLevel_None + /// + UIA_HeadingLevelPropertyId = 30173, + + /// + /// Identifies the HelpText property, which is a help text string associated with the automation element. + /// + /// The HelpText property can be supported with placeholder text appearing in edit or list controls. For example, "Type text here for + /// search" is a good candidate the HelpText property for an edit control that places the text prior to the user's actual input. + /// However, it is not adequate for the name property of the edit control. + /// + /// When HelpText is supported, the string must match the application UI language or the operating system default UI language. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_HelpTextPropertyId = 30013, + + /// + /// Identifies the IsContentElement property, which is a Boolean value that specifies whether the element appears in the content view + /// of the automation element tree. For more information, see UI Automation Tree Overview. + /// [!Note] + /// + /// For an element to appear in the content view, both the IsContentElement property and the IsControlElement property must be TRUE. + /// + /// Variant type: VT_BOOL + /// Default value: TRUE + /// + UIA_IsContentElementPropertyId = 30017, + + /// + /// Identifies the IsControlElement property, which is a Boolean value that specifies whether the element appears in the control view + /// of the automation element tree. For more information, see UI Automation Tree Overview. + /// Variant type: VT_BOOL + /// Default value: TRUE + /// + UIA_IsControlElementPropertyId = 30016, + + /// + /// Identifies the IsDataValidForForm property, which is a Boolean value that indicates whether the entered or selected value is + /// valid for the form rule associated with the automation element. For example, if the user entered "425-555-5555" for a zip code + /// field that requires 5 or 9 digits, the IsDataValidForForm property can be set to FALSE to indicate that the data is not valid. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsDataValidForFormPropertyId = 30103, + + /// + /// Identifies the IsDialog property, which is a Boolean value that indicates whether the automation element is a dialog window. For + /// example, assistive technology such as screen readers typically speak the title of the dialog, the focused control in the dialog, + /// and then the content of the dialog up to the focused control ("Do you want to save your changes before closing"). For standard + /// windows, a screen reader typically speaks the window title followed by the focused control. The IsDialog property can be set to + /// TRUE to indicate that the client application should treat the element as a dialog window. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsDialogPropertyId = 30174, + + /// + /// Identifies the IsEnabled property, which is a Boolean value that indicates whether the UI item referenced by the automation + /// element is enabled and can be interacted with. + /// + /// When the enabled state of a control is FALSE, it is assumed that child controls are also not enabled. Clients should not expect + /// property-changed events from child elements when the state of the parent control changes. + /// + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsEnabledPropertyId = 30010, + + /// + /// Identifies the IsKeyboardFocusable property, which is a Boolean value that indicates whether the automation element can accept + /// keyboard focus. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsKeyboardFocusablePropertyId = 30009, + + /// + /// Identifies the IsOffscreen property, which is a Boolean value that indicates whether the automation element is entirely scrolled + /// out of view (for example, an item in a list box that is outside the viewport of the container object) or collapsed out of view + /// (for example, an item in a tree view or menu, or in a minimized window). If the element has a clickable point that can cause it + /// to receive the focus, the element is considered to be on-screen while a portion of the element is off-screen. + /// + /// The value of the property is not affected by occlusion by other windows, or by whether the element is visible on a specific monitor. + /// + /// + /// If the IsOffscreen property is TRUE, the UI element is scrolled off-screen or collapsed. The element is temporarily hidden, yet + /// it remains in the end-user's perception and continues to be included in the UI model. The object can be brought back into view by + /// scrolling, clicking a drop-down, and so on. + /// + /// + /// Objects that the end-user does not perceive at all, or that are "programmatically hidden" (for example, a dialog box that has + /// been dismissed, but the underlying object is still cached by the application) should not be in the automation element tree in the + /// first place (instead of setting the state of IsOffscreen to TRUE). + /// + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsOffscreenPropertyId = 30022, + + /// + /// Identifies the IsPassword property, which is a Boolean value that indicates whether the automation element contains protected + /// content or a password. + /// + /// When the IsPassword property is TRUE and the element has the keyboard focus, a client application should disable keyboard echoing + /// or keyboard input feedback that may expose the user's protected information. Attempting to access the Value property of the + /// protected element (edit control) may cause an error to occur. + /// + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsPasswordPropertyId = 30019, + + /// + /// Identifies the IsPeripheral property, which is a Boolean value that indicates whether the automation element represents + /// peripheral UI. Peripheral UI appears and supports user interaction, but does not take keyboard focus when it appears. Examples of + /// peripheral UI includes popups, flyouts, context menus, or floating notifications. Supported starting with Windows 8.1. + /// + /// When the IsPeripheral property is TRUE, a client application can't assume that focus was taken by the element even if it's + /// currently keyboard-interactive. + /// + /// This property is relevant for these control types: + /// UIA_GroupControlTypeId + /// UIA_MenuControlTypeId + /// UIA_PaneControlTypeId + /// UIA_ToolBarControlTypeId + /// UIA_ToolTipControlTypeId + /// UIA_WindowControlTypeId + /// UIA_CustomControlTypeId + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsPeripheralPropertyId = 30150, + + /// + /// Identifies the IsRequiredForForm property, which is a Boolean value that indicates whether the automation element is required to + /// be filled out on a form. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsRequiredForFormPropertyId = 30025, + + /// + /// Identifies the ItemStatus property, which is a text string describing the status of an item of the automation element. + /// + /// ItemStatus enables a client to ascertain whether an element is conveying status about an item as well as what the status is. For + /// example, an item associated with a contact in a messaging application might be "Busy" or "Connected". + /// + /// When ItemStatus is supported, the string must match the application UI language or the operating system default UI language. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_ItemStatusPropertyId = 30026, + + /// + /// Identifies the ItemType property, which is a text string describing the type of the automation element. + /// + /// ItemType is used to obtain information about items in a list, tree view, or data grid. For example, an item in a file directory + /// view might be a "Document File" or a "Folder". + /// + /// When ItemType is supported, the string must match the application UI language or the operating system default UI language. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_ItemTypePropertyId = 300021, + + /// + /// Identifies the LabeledBy property, which is an automation element that contains the text label for this element. + /// This property can be used to retrieve, for example, the static text label for a combo box. + /// Variant type: VT_UNKNOWN + /// Default value: NULL + /// + UIA_LabeledByPropertyId = 30018, + + /// + /// Identifies the LandmarkType property, which is a Landmark Type Identifier associated with an element. + /// + /// The LandmarkType property describes an element that represents a group of elements. For example, a search landmark could + /// represent a set of related controls for searching. + /// + /// If UIA_CustomLandmarkTypeId is used then UIA_LocalizedLandmarkTypePropertyId is required to describe the custom landmark. + /// Variant Type: VT_I4 + /// Default Value: 0 + /// + UIA_LandmarkTypePropertyId = 30157, + + /// + /// Identifies the Level property, which is a 1-based integer associated with an automation element. + /// + /// The Level property describes the location of an element inside a hierarchical or broken hierarchical structures. For example a + /// bulleted/numbered list, headings, or other structured data items can have various parent/child relationships. Level describes + /// where in the structure the item is located. + /// + /// It is recommended to use the CustomNavigation Control Pattern in tandem with Level. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_LevelPropertyId = 30154, + + /// + /// Identifies the LiveSetting property, which is supported by an automation element that represents a live region. The LiveSetting + /// property indicates the "politeness" level that a client should use to notify the user of changes to the live region. This + /// property can be one of the values from the LiveSetting enumeration. Supported starting with Windows 8. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_LiveSettingPropertyId = 30135, + + /// + /// Identifies the LocalizedControlType property, which is a text string describing the type of control that the automation element + /// represents. The string should contain only lowercase characters: + /// Correct: "button" + /// Incorrect: "Button" + /// + /// When LocalizedControlType is not specified by the element provider, the default localized string is supplied by the framework, + /// according to the control type of the element (for example, "button" for the Button control type). An automation element with the + /// Custom control type must support a localized control type string that represents the role of the element (for example, "color + /// picker" for a custom control that enables users to choose and specify colors). + /// + /// When a custom value is supplied, the string must match the application UI language or the operating system default UI language. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LocalizedControlTypePropertyId = 30004, + + /// + /// Identifies the LocalizedLandmarkType, which is a text string describing the type of landmark that the automation element represents. + /// + /// This should be used in tandem with UIA_CustomLandmarkTypeId however, LocalizedLandmarkType should always take precedence over + /// LandmarkType and be used to describe the landmark before LandmarkType. + /// + /// The string must match the application UI language or the operating system default UI language. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LocalizedLandmarkTypePropertyId = 30158, + + /// + /// Identifies the Name property, which is a string that holds the name of the automation element. + /// + /// The Name property should be the same as the label text on screen. For example, Name should be "Browse" for a button element with + /// the label "Browse". The Name property must not include the mnemonic character for the access keys (that is, "&"), which is + /// underlined in the UI text presentation. Also, the Name property should not be an extended or modified version of the on-screen + /// label because the inconsistency between the name and the label can cause confusion among client applications and users. + /// + /// + /// When the corresponding label text is not visible on screen, or when it is replaced by graphics, alternative text should be + /// chosen. The alternative text should be concise, intuitive, and localized to the application UI language, or to the operating + /// system default UI language. The alternative text should not be a detailed description of the visual details, but a concise + /// description of the UI function or feature as if it were labeled by simple text. For example, the Windows Start menu button is + /// named "Start" (button) instead of "Windows Logo on blue round sphere graphics" (button). For more information, see Creating Text + /// Equivalents for Images. + /// + /// + /// When a UI label uses text graphics (for example, using ">>" for a button that adds an item from left to right), the Name + /// property should be overridden by an appropriate text alternative (for example, "Add"). However the practice of using text + /// graphics as a UI label is discouraged due to both localization and accessibility concerns. + /// + /// + /// The Name property must not include the control role or type information, such as "button" or "list"; otherwise, it will conflict + /// with the text from the LocalizedControlType property when these two properties are appended (many existing assistive technologies + /// do this). + /// + /// + /// The Name property cannot be used as a unique identifier among siblings. However, as long as it is consistent with the UI + /// presentation, the same Name value can be supported among peers. For test automation, the clients should consider using the + /// AutomationId or RuntimeId property. + /// + /// + /// Text controls do not always have to have the Name property be identical to the text that is displayed within the control, so long + /// as the Text pattern is also supported. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_NamePropertyId = 30005, + + /// + /// Identifies the NativeWindowHandle property, which is an integer that represents the handle (HWND) of the automation element + /// window, if it exists; otherwise, this property is 0. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_NativeWindowHandlePropertyId = 30020, + + /// + /// Identifies the OptimizeForVisualContent property, which is a Boolean value that indicates whether the provider exposes only + /// elements that are visible. A provider can use this property to optimize performance when working with very large pieces of + /// content. For example, as the user pages through a large piece of content, the provider can destroy content elements that are no + /// longer visible. When a content element is destroyed, the provider should return the UIA_E_ELEMENTNOTAVAILABLE error code. + /// Supported starting with Windows 8. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_OptimizeForVisualContentPropertyId = 30111, + + /// + /// Identifies the Orientation property, which indicates the orientation of the control represented by the automation element. The + /// property is expressed as a value from the OrientationType enumerated type. + /// + /// The Orientation property is supported by controls, such as scroll bars and sliders, that can have either a vertical or a + /// horizontal orientation. Otherwise, it can always be OrientationType_None, which means that the control has no orientation. + /// + /// Variant type: VT_I4 + /// Default value: 0 (OrientationType_None) + /// + UIA_OrientationPropertyId = 300023, + + /// + /// Identifies the OutlineColor property, which specifies the color used for the outline of the automation element. This attribute is + /// specified as a COLORREF, a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 | VT_ARRAY + /// Default value: 0 + /// + UIA_OutlineColorPropertyId = 30161, + + /// + /// Identifies the OutlineThickness property, which specifies the width for the outline of the automation element. + /// Variant type: VT_R8 | VT_ARRAY + /// Default value: VT_EMPTY + /// + UIA_OutlineThicknessPropertyId = 30164, + + /// + /// Identifies the PositionInSet property, which is a 1-based integer associated with an automation element. PositionInSet describes + /// the ordinal location of the element within a set of elements which are considered to be siblings. + /// PositionInSet works in coordination with the SizeOfSet property to describe the ordinal location in the set. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_PositionInSetPropertyId = 30152, + + /// + /// Identifies the ProcessId property, which is an integer representing the process identifier (ID) of the automation element. + /// + /// The process identifier (ID) is assigned by the operating system. It can be seen in the PID column of the Processes tab in Task Manager. + /// + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_ProcessIdPropertyId = 30002, + + /// + /// Identifies the ProviderDescription property, which is a formatted string containing the source information of the UI Automation + /// provider for the automation element, including proxy information. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_ProviderDescriptionPropertyId = 30107, + + /// + /// Identifies the Rotation property, which specifies the angle of rotation in unspecified units. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_RotationPropertyId = 30166, + + /// + /// Identifies the RuntimeId property, which is an array of integers representing the identifier for an automation element. + /// + /// The identifier is unique on the desktop, but it is guaranteed to be unique only within the UI of the desktop on which it was + /// generated. Identifiers can be reused over time. + /// + /// + /// The format of RuntimeId can change. The returned identifier should be treated as an opaque value and used only for comparison; + /// for example, to determine whether an automation element is in the cache. + /// + /// Variant type: VT_I4 | VT_ARRAY + /// Default value: VT_EMPTY + /// + UIA_RuntimeIdPropertyId = 30000, + + /// + /// Identifies the Size property, which specifies the width and height of the automation element. + /// Variant type: VT_R8 | VT_ARRAY + /// Default value: VT_EMPTY + /// + UIA_SizePropertyId = 30167, + + /// + /// Identifies the SizeOfSet property, which is a 1-based integer associated with an automation element. SizeOfSet describes the + /// count of automation elements in a group or set that are considered to be siblings. + /// SizeOfSet works in coordination with the PositionInSet property to describe the count of items in the set. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_SizeOfSetPropertyId = 30153, + + /// + /// Identifies the VisualEffects property, which is a bit field that specifies effects on the automation element, such as shadow, + /// reflection, glow, soft edges, or bevel. + /// VisualEffects: + /// VisualEffects_Shadow: 0x1 + /// VisualEffects_Reflection: 0x2 + /// VisualEffects_Glow: 0x4 + /// VisualEffects_SoftEdges: 0x8 + /// VisualEffects_Bevel: 0x10 + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_VisualEffectsPropertyId = 30163, + + /// + /// Identifies the AnnotationTypeId property of the Annotation control pattern. Supported starting with Windows 8. + /// This property indicates the type of an annotation. For a list of possible values, see Annotation Type Identifiers. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_AnnotationAnnotationTypeIdPropertyId = 30113, + + /// + /// Identifies the AnnotationTypeName property of the Annotation control pattern. Supported starting with Windows 8. + /// + /// This property is a localized string that contains the name of an annotation type. The name can correspond to one of the + /// annotation type identifiers (for example, Comment for AnnotationType_Comment), but it is not required to. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AnnotationAnnotationTypeNamePropertyId = 30114, + + /// + /// Identifies the Author property of the Annotation control pattern. Supported starting with Windows 8. + /// This property is a string that contains the name of the person who authored the annotation. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AnnotationAuthorPropertyId = 30115, + + /// + /// Identifies the DateTime property of the Annotation control pattern. Supported starting with Windows 8. + /// This property is a string that contains the date and time when the annotation was created. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_AnnotationDateTimePropertyId = 30116, + + /// + /// Identifies the Target property of the Annotation control pattern. Supported starting with Windows 8. + /// This property is the IUIAutomationElement interface of the element that is being annotated. + /// Variant type: VT_UNKNOWN + /// Default value: NULL + /// + UIA_AnnotationTargetPropertyId = 30117, + + /// + /// Identifies the DockPosition property of the Dock control pattern. + /// + /// This property indicates the dock position of the automation element within a docking container, and is expressed as a value from + /// the DockPosition enumerated type. + /// + /// Variant type: VT_I4 + /// Default value: DockPosition_None + /// + UIA_DockDockPositionPropertyId = 30069, + + /// + /// Identifies the DropEffect property of the Drag control pattern. Supported starting with Windows 8. + /// This property indicates what happens when an element is dropped as part of a drag-drop operation. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_DragDropEffectPropertyId = 30139, + + /// + /// Identifies the DropEffects property of the Drag control pattern. Supported starting with Windows 8. + /// + /// This property is a collection of strings that enumerate the possible effects that can happen when an element is dropped as part + /// of a drag-drop operation. + /// + /// Variant type: VT_BSTR | VT_ARRAY + /// Default value: empty array + /// + UIA_DragDropEffectsPropertyId = 30140, + + /// + /// Identifies the IsGrabbed property of the Drag control pattern. Supported starting with Windows 8. + /// This property indicates whether an element is being dragged. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_DragIsGrabbedPropertyId = 30138, + + /// + /// Identifies the GrabbedItems property of the Drag control pattern. Supported starting with Windows 8. + /// This property is a collection of elements that are being dragged as part of a drag operation. + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_DragGrabbedItemsPropertyId = 30144, + + /// + /// Identifies the DropTargetEffect property of the DropTarget control pattern. Supported starting with Windows 8. + /// This property indicates the current drop effect for the element being dragged. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_DropTargetDropTargetEffectPropertyId = 30142, + + /// + /// Identifies the DropTargetEffects property of the DropTarget control pattern. Supported starting with Windows 8. + /// This property indicates the possible drop effects that can happen when an element is dropped on a drop target. + /// Variant type: VT_BSTR | VT_ARRAY + /// Default value: empty array + /// + UIA_DropTargetDropTargetEffectsPropertyId = 30143, + + /// + /// Identifies the ExpandCollapseState property of the ExpandCollapse control pattern. + /// + /// This property indicates the current state, expanded or collapsed, of the automation element, and is expressed as a value from the + /// ExpandCollapseState enumerated type. + /// + /// Variant type: VT_I4 + /// Default value: ExpandCollapseState_LeafNode + /// + UIA_ExpandCollapseExpandCollapseStatePropertyId = 30070, + + /// + /// Identifies the ColumnCount property of the Grid control pattern. + /// This property indicates the total number of columns in the grid. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_GridColumnCountPropertyId = 30063, + + /// + /// Identifies the Column property of the GridItem control pattern. + /// This property indicates the ordinal number of the column that contains the cell or item. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_GridItemColumnPropertyId = 30065, + + /// + /// Identifies the ColumnSpan property of the GridItem control pattern. + /// This property indicates the number of columns spanned by the cell or item. + /// Variant type:VT_I4 + /// Default value: 1 + /// + UIA_GridItemColumnSpanPropertyId = 30067, + + /// + /// Identifies the ContainingGrid property of the GridItem control pattern. + /// + /// This property is the IUIAutomationElement interface pointer of the automation element that contains the cell or item. The + /// container element implements the Grid control pattern (IGridProvider). + /// + /// Variant type: VT_UNKNOWN + /// Default value: NULL + /// + UIA_GridItemContainingGridPropertyId = 30068, + + /// + /// Identifies the Row property of the GridItem control pattern. + /// This property is the ordinal number of the row that contains the cell or item. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_GridItemRowPropertyId = 30064, + + /// + /// Identifies the RowSpan property of the GridItem control pattern. + /// This property indicates the number of rows spanned by the cell or item. + /// Variant type: VT_I4 + /// Default value: 1 + /// + UIA_GridItemRowSpanPropertyId = 30066, + + /// + /// Identifies the RowCount property of the Grid control pattern. + /// This property indicates the total number of rows in the grid. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_GridRowCountPropertyId = 30062, + + /// + /// Identifies the ChildId property of the LegacyIAccessible control pattern. + /// This property is the Microsoft Active Accessibility (MSAA) child identifier of the automation element. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_LegacyIAccessibleChildIdPropertyId = 30091, + + /// + /// Identifies the DefaultAction property of the LegacyIAccessible control pattern. + /// This property is the MSAA default action (accDefaultAction) for the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LegacyIAccessibleDefaultActionPropertyId = 30100, + + /// + /// Identifies the Description property of the LegacyIAccessible control pattern. + /// This property is the MSAA description (accDescription) for the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LegacyIAccessibleDescriptionPropertyId = 30094, + + /// + /// Identifies the Help property of the LegacyIAccessible control pattern. + /// This property is the MSAA help string (accHelp) for the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LegacyIAccessibleHelpPropertyId = 30097, + + /// + /// Identifies the KeyboardShortcut property of the LegacyIAccessible control pattern. + /// This property is the MSAA keyboard shortcut string (accKeyboardShortcut) for the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LegacyIAccessibleKeyboardShortcutPropertyId = 30098, + + /// + /// Identifies the Name property of the LegacyIAccessible control pattern. + /// This property is the MSAA name string (accName) for the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LegacyIAccessibleNamePropertyId = 30092, + + /// + /// Identifies the Roleproperty of the LegacyIAccessible control pattern. + /// This property is the MSAA role identifier (accRole) for the automation element. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_LegacyIAccessibleRolePropertyId = 30095, + + /// + /// Identifies the Selection property of the LegacyIAccessible control pattern. + /// This property is the MSAA list of selected items (accSelection) in the control represented by the automation element. + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_LegacyIAccessibleSelectionPropertyId = 30099, + + /// + /// Identifies the State property of the LegacyIAccessible control pattern. + /// This property is the MSAA state (accState) of the automation element. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_LegacyIAccessibleStatePropertyId = 30096, + + /// + /// Identifies the Value property of the LegacyIAccessible control pattern. + /// This property is the MSAA value (accValue) of the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_LegacyIAccessibleValuePropertyId = 30093, + + /// + /// Identifies the CurrentView property of the MultipleView control pattern. + /// This property indicates the current view state of the automation element. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_MultipleViewCurrentViewPropertyId = 30071, + + /// + /// Identifies the SupportedViews property of the MultipleView control pattern. + /// This property is a list of identifiers for the view states supported by the automation element. + /// Variant type: VT_I4 | VT_ARRAY + /// Default value: empty array + /// + UIA_MultipleViewSupportedViewsPropertyId = 30072, + + /// + /// Identifies the IsReadOnly property of the RangeValue control pattern. + /// This property indicates whether the value of the automation element is read-only. + /// Variant type: VT_BOOL + /// Default value: TRUE + /// + UIA_RangeValueIsReadOnlyPropertyId = 30048, + + /// + /// Identifies the LargeChange property of the RangeValue control pattern. + /// + /// This property is the large-change value, unique to the automation element, that is added to or subtracted from the Value property. + /// + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_RangeValueLargeChangePropertyId = 30051, + + /// + /// Identifies the Maximum property of the RangeValue control pattern. + /// This property is the maximum range value supported by the automation element. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_RangeValueMaximumPropertyId = 30050, + + /// + /// Identifies the Minimum property of the RangeValue control pattern. + /// This property is the minimum range value supported by the automation element. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_RangeValueMinimumPropertyId = 30049, + + /// + /// Identifies the SmallChange property of the RangeValue control pattern. + /// + /// This property is the small-change value, unique to the automation element, that is added to or subtracted from the Value property. + /// + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_RangeValueSmallChangePropertyId = 30052, + + /// + /// Identifies the Value property of the RangeValue control pattern. + /// This property is the current value of the automation element. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_RangeValueValuePropertyId = 30047, + + /// + /// Identifies the HorizontallyScrollable property of the Scroll control pattern. + /// This property indicates whether the automation element can scroll horizontally. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_ScrollHorizontallyScrollablePropertyId = 30057, + + /// + /// Identifies the HorizontalScrollPercent property of the Scroll control pattern. + /// + /// This property is the current horizontal scroll position expressed as a percentage of the total content area within the automation element. + /// + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_ScrollHorizontalScrollPercentPropertyId = 30053, + + /// + /// Identifies the HorizontalViewSize property of the Scroll control pattern. + /// + /// This property is the horizontal size of the viewable region expressed as a percentage of the total content area within the element. + /// + /// Variant type: VT_R8 + /// Default value: 100 + /// + UIA_ScrollHorizontalViewSizePropertyId = 30054, + + /// + /// Identifies the VerticallyScrollable property of the Scroll control pattern. + /// This property indicates whether the automation element can scroll vertically. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_ScrollVerticallyScrollablePropertyId = 30058, + + /// + /// Identifies the VerticalScrollPercent property of the Scroll control pattern. + /// + /// This property is the current vertical scroll position expressed as a percentage of the total content area within the automation element. + /// + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_ScrollVerticalScrollPercentPropertyId = 30055, + + /// + /// Identifies the VerticalViewSize property of the Scroll control pattern. + /// + /// This property is the vertical size of the viewable region expressed as a percentage of the total content area within the element. + /// + /// Variant type: VT_R8 + /// Default value: 100 + /// + UIA_ScrollVerticalViewSizePropertyId = 30056, + + /// + /// Identifies the CanSelectMultiple property of the Selection control pattern. + /// This property indicates whether the automation element allows more than one child element to be selected concurrently. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_SelectionCanSelectMultiplePropertyId = 30060, + + /// + /// Identifies the IsSelectionRequired property of the Selection control pattern. + /// This property indicates whether the automation element requires at least one child item to be selected. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_SelectionIsSelectionRequiredPropertyId = 30061, + + /// + /// Identifies the Selection property of the Selection control pattern. + /// This property is a collection of the selected child elements, and is expressed as an IUIAutomationElementArray pointer. + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_SelectionSelectionPropertyId = 30059, + + /// + /// Identifies the IsSelected property of the SelectionItem control pattern. + /// This property indicates whether the automation element is selected. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_SelectionItemIsSelectedPropertyId = 30079, + + /// + /// Identifies the SelectionContainer property of the SelectionItem control pattern. + /// This property is the IUIAutomationElement interface pointer for the automation element that contains the current element. + /// Variant type: VT_UNKNOWN + /// Default value: NULL + /// + UIA_SelectionItemSelectionContainerPropertyId = 30080, + + /// + /// Identifies the Formula property of the SpreadsheetItem control pattern. + /// This property is a string that contains the formula for the spreadsheet cell. Supported starting with Windows 8. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_SpreadsheetItemFormulaPropertyId = 30129, + + /// + /// Identifies the AnnotationObjects property of the SpreadsheetItem control pattern. + /// + /// This property is a collection of UI Automation elements representing the annotations associated with the spreadsheet cell. The + /// collection is expressed as an IUIAutomationElementArray interface. Supported starting with Windows 8. + /// + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_SpreadsheetItemAnnotationObjectsPropertyId = 30130, + + /// + /// Identifies the AnnotationTypes property of the SpreadsheetItem control pattern. Supported starting with Windows 8. + /// + /// This property is array of annotation type identifiers, one for each type of annotation associated with the spreadsheet cell. For + /// a list of possible values, see Annotation Type Identifiers. + /// + /// Variant type: VT_I4 | VT_ARRAY + /// Default value: empty array + /// + UIA_SpreadsheetItemAnnotationTypesPropertyId = 30131, + + /// + /// Identifies the ExtendedProperties property of the Styles control pattern. + /// + /// This property contains a localized, formatted string that contains additional properties that are not included in the Styles + /// control pattern, but that provide information about the document content that might be useful to the user. The format of the + /// string is as follows: "prop1=value;prop2=value2". Supported starting with Windows 8. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_StylesExtendedPropertiesPropertyId = 30126, + + /// + /// Identifies the FillColor property of the Styles control pattern. + /// + /// This property specifies the color used to fill an element. This property is expressed as a COLORREF, a 32-bit value used to + /// specify an RGB or RGBA color. Supported starting with Windows 8. + /// + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_StylesFillColorPropertyId = 30122, + + /// + /// Identifies the FillPatternColor property of the Styles control pattern. + /// + /// This property specifies the color of the pattern used to fill an element. This property is expressed as a COLORREF, a 32-bit + /// value used to specify an RGB or RGBA color. Supported starting with Windows 8. + /// + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_StylesFillPatternColorPropertyId = 30125, + + /// + /// Identifies the FillPatternStyle property of the Styles control pattern. + /// + /// This property is a localized string that contains the style of the pattern used to fill an element, such as "Vertical Stripe". + /// Supported starting with Windows 8. + /// + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_StylesFillPatternStylePropertyId = 30123, + + /// + /// Identifies the Shape property of the Styles control pattern. + /// This property is a localized string that indicates the shape of the element. Supported starting with Windows 8. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_StylesShapePropertyId = 30124, + + /// + /// Identifies the StyleId property of the Styles control pattern. + /// + /// This property identifies the visual style of the element. For a list of possible values, see Style Identifiers. Supported + /// starting with Windows 8. + /// + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_StylesStyleIdPropertyId = 30120, + + /// + /// Identifies the StyleName property of the Styles control pattern. + /// This property is the name of the visual style of the element. Supported starting with Windows 8. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_StylesStyleNamePropertyId = 30121, + + /// + /// Identifies the ColumnHeaders property of the Table control pattern. + /// + /// This property is a collection of automation elements for all column headers in the table, and is expressed as an + /// IUIAutomationElementArray interface pointer. + /// + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_TableColumnHeadersPropertyId = 30082, + + /// + /// Identifies the ColumnHeaderItems property of the TableItem control pattern. + /// + /// This property is a collection of automation elements for all column headers in the table item or cell, and is expressed as an + /// IUIAutomationElementArray interface pointer. + /// + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_TableItemColumnHeaderItemsPropertyId = 30085, + + /// + /// Identifies the RowHeaders property of the Table control pattern. + /// + /// This property is a collection of automation elements for all row headers in the table, and is expressed as an + /// IUIAutomationElementArray interface pointer. + /// + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_TableRowHeadersPropertyId = 30081, + + /// + /// Identifies the RowOrColumnMajor property of the Table control pattern. + /// + /// This property indicates the primary direction of traversal for the table, and is expressed as a value from the RowOrColumnMajor + /// enumerated type. + /// + /// Variant type: VT_I4 + /// Default value: RowOrColumnMajor_Indeterminate + /// + UIA_TableRowOrColumnMajorPropertyId = 30083, + + /// + /// Identifies the RowHeaderItems property of the TableItem control pattern. + /// + /// This property is a collection of automation elements for all row headers in the table item or cell, and is expressed as an + /// IUIAutomationElementArray interface pointer. + /// + /// Variant type: VT_UNKNOWN | VT_ARRAY + /// Default value: empty array + /// + UIA_TableItemRowHeaderItemsPropertyId = 30084, + + /// + /// Identifies the ToggleState property of the Toggle control pattern. + /// + /// This property indicates the toggle state of the automation element, and is expressed as a value from the ToggleState enumerated type. + /// + /// Variant type: VT_I4 + /// Default value: ToggleState_Indeterminate + /// + UIA_ToggleToggleStatePropertyId = 30086, + + /// + /// Identifies the CanMove property of the Transform control pattern. + /// This property indicates whether the automation element can be moved. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_TransformCanMovePropertyId = 30087, + + /// + /// Identifies the CanResize property of the Transform control pattern. + /// This property indicates whether the automation element can be resized. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_TransformCanResizePropertyId = 30088, + + /// + /// Identifies the CanRotate property of the Transform control pattern. + /// This property indicates whether the automation element can be rotated. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_TransformCanRotatePropertyId = 30089, + + /// + /// Identifies the CanZoom property of the Transform control pattern. + /// This property indicates whether the control supports zooming of its viewport. Supported starting with Windows 8. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_Transform2CanZoomPropertyId = 30133, + + /// + /// Identifies the ZoomLevel property of the Transform control pattern. Supported starting with Windows 8. + /// This property indicates the current zooming level of the control's viewport. + /// Variant type: VT_R8 + /// Default value: 1 + /// + UIA_Transform2ZoomLevelPropertyId = 30145, + + /// + /// Identifies the ZoomMaximum property of the Transform control pattern. Supported starting with Windows 8. + /// This property indicates the maximum zooming level supported by the control's viewport. + /// Variant type: VT_R8 + /// Default value: 1 + /// + UIA_Transform2ZoomMaximumPropertyId = 30147, + + /// + /// Identifies the ZoomMinimum property of the Transform control pattern. Supported starting with Windows 8. + /// This property indicates the minimum zooming level supported by the control's viewport. + /// Variant type: VT_R8 + /// Default value: 1 + /// + UIA_Transform2ZoomMinimumPropertyId = 30146, + + /// + /// Identifies the IsReadOnly property of the Value control pattern. + /// This property indicates whether the value of the automation element is read-only. + /// Variant type: VT_BOOL + /// Default value: TRUE + /// + UIA_ValueIsReadOnlyPropertyId = 30046, + + /// + /// Identifies the Value property of the Value control pattern. + /// This property indicates the value of the automation element. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_ValueValuePropertyId = 30045, + + /// + /// Identifies the CanMaximize property of the Window control pattern. + /// This property indicates whether the window can be maximized. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_WindowCanMaximizePropertyId = 30073, + + /// + /// Identifies the CanMinimize property of the Window control pattern. + /// This property indicates whether the window can be minimized. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_WindowCanMinimizePropertyId = 30074, + + /// + /// Identifies the IsModal property of the Window control pattern. + /// This property indicates whether the window is modal. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_WindowIsModalPropertyId = 30077, + + /// + /// Identifies the IsTopmost property of the Window control pattern. + /// This property indicates whether the window is the topmost element in the z-order. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_WindowIsTopmostPropertyId = 30078, + + /// + /// Identifies the WindowInteractionState property of the Window control pattern. + /// + /// This property indicates the state of the window for the purposes of user interaction, and is expressed as a value from the + /// WindowInteractionState enumerated type. + /// + /// Variant type: VT_I4 + /// Default value: WindowInteractionState_Running + /// + UIA_WindowWindowInteractionStatePropertyId = 30076, + + /// + /// Identifies the WindowVisualState property of the Window control pattern. + /// + /// This property indicates the visual state of the window, and is expressed as a value from the WindowVisualState enumerated type. + /// + /// Variant type: VT_I4 + /// Default value: WindowVisualState_Normal + /// + UIA_WindowWindowVisualStatePropertyId = 30075, + + /// + /// Identifies the IsAnnotationPatternAvailable property, which indicates whether the Annotation control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationAnnotationPattern interface from the element. Supported + /// starting with Windows 8. + /// + UIA_IsAnnotationPatternAvailablePropertyId = 30118, + + /// + /// Identifies the IsCustomNavigationPatternAvailable property, which indicates whether the CustomNavigation control pattern is + /// available for the automation element. If TRUE, a client can retrieve an IUIAutomationCustomNavigationPattern interface from the + /// element. Supported starting with Windows 10. + /// + UIA_IsCustomNavigationPatternAvailablePropertyId = 30151, + + /// + /// Identifies the IsDockPatternAvailable property, which indicates whether the Dock control pattern is available for the automation + /// element. If TRUE, a client can retrieve an IUIAutomationDockPattern interface from the element. + /// + UIA_IsDockPatternAvailablePropertyId = 30027, + + /// + /// Identifies the IsDragPatternAvailable property, which indicates whether the Drag control pattern is available for the automation + /// element. If TRUE, a client can retrieve an IUIAutomationDragPattern interface from the element. Supported starting with Windows 8. + /// + UIA_IsDragPatternAvailablePropertyId = 30137, + + /// + /// Identifies the IsDropTargetPatternAvailable property, which indicates whether the DropTarget control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationDropTargetPattern interface from the element. Supported + /// starting with Windows 8. + /// + UIA_IsDropTargetPatternAvailablePropertyId = 30141, + + /// + /// Identifies the IsExpandCollapsePatternAvailable property, which indicates whether the ExpandCollapse control pattern is available + /// for the automation element. If TRUE, a client can retrieve an IUIAutomationExpandCollapsePattern interface from the element. + /// + UIA_IsExpandCollapsePatternAvailablePropertyId = 30028, + + /// + /// Identifies the IsGridItemPatternAvailable property, which indicates whether the GridItem control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationGridItemPattern interface from the element. + /// + UIA_IsGridItemPatternAvailablePropertyId = 30029, + + /// + /// Identifies the IsGridPatternAvailable property, which indicates whether the Grid control pattern is available for the automation + /// element. If TRUE, a client can retrieve an IUIAutomationGridPattern interface from the element. + /// + UIA_IsGridPatternAvailablePropertyId = 30030, + + /// + /// Identifies the IsInvokePatternAvailable property, which indicates whether the Invoke control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationInvokePattern interface from the element. + /// + UIA_IsInvokePatternAvailablePropertyId = 30031, + + /// + /// Identifies the IsItemContainerPatternAvailable property, which indicates whether the ItemContainer control pattern is available + /// for the automation element. If TRUE, a client can retrieve an IUIAutomationItemContainerPattern interface from the element. + /// + UIA_IsItemContainerPatternAvailablePropertyId = 30108, + + /// + /// Identifies the IsLegacyIAccessiblePatternAvailable property, which indicates whether the LegacyIAccessible control pattern is + /// available for the automation element. If TRUE, a client can retrieve an IUIAutomationLegacyIAccessiblePattern interface from the element. + /// + UIA_IsLegacyIAccessiblePatternAvailablePropertyId = 30090, + + /// + /// Identifies the IsMultipleViewPatternAvailable property, which indicates whether the MultipleView control pattern is available for + /// the automation element. If TRUE, a client can retrieve an IUIAutomationMultipleViewPattern interface from the element. + /// + UIA_IsMultipleViewPatternAvailablePropertyId = 30032, + + /// + /// Identifies the IsObjectModelPatternAvailable property, which indicates whether the ObjectModel control pattern is available for + /// the automation element. If TRUE, a client can retrieve an IUIAutomationObjectModelPattern interface from the element. Supported + /// starting with Windows 8. + /// + UIA_IsObjectModelPatternAvailablePropertyId = 30112, + + /// + /// Identifies the IsRangeValuePatternAvailable property, which indicates whether the RangeValue control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationRangeValuePattern interface from the element. + /// + UIA_IsRangeValuePatternAvailablePropertyId = 30033, + + /// + /// Identifies the IsScrollItemPatternAvailable property, which indicates whether the ScrollItem control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationScrollItemPattern interface from the element. + /// + UIA_IsScrollItemPatternAvailablePropertyId = 30035, + + /// + /// Identifies the IsScrollPatternAvailable property, which indicates whether the Scroll control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationScrollPattern interface from the element. + /// + UIA_IsScrollPatternAvailablePropertyId = 30034, + + /// + /// Identifies the IsSelectionItemPatternAvailable property, which indicates whether the SelectionItem control pattern is available + /// for the automation element. If TRUE, a client can retrieve an IUIAutomationSelectionItemPattern interface from the element. + /// + UIA_IsSelectionItemPatternAvailablePropertyId = 30036, + + /// + /// Identifies the IsSelectionPatternAvailable property, which indicates whether the Selection control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationSelectionPattern interface from the element. + /// + UIA_IsSelectionPatternAvailablePropertyId = 30037, + + /// + /// Identifies the IsSpreadsheetPatternAvailable property, which indicates whether the Spreadsheet control pattern is available for + /// the automation element. If TRUE, a client can retrieve an IUIAutomationSpreadsheetPattern interface from the element. Supported + /// starting with Windows 8. + /// + UIA_IsSpreadsheetPatternAvailablePropertyId = 30128, + + /// + /// Identifies the IsSpreadsheetItemPatternAvailable property, which indicates whether the SpreadsheetItem control pattern is + /// available for the automation element. If TRUE, a client can retrieve an IUIAutomationSpreadsheetItemPattern interface from the + /// element. Supported starting with Windows 8. + /// + UIA_IsSpreadsheetItemPatternAvailablePropertyId = 30132, + + /// + /// Identifies the IsStylesPatternAvailable property, which indicates whether the Styles control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationStylesPattern interface from the element. Supported starting + /// with Windows 8. + /// + UIA_IsStylesPatternAvailablePropertyId = 30127, + + /// + /// Identifies the IsSynchronizedInputPatternAvailable property, which indicates whether the SynchronizedInput control pattern is + /// available for the automation element. If TRUE, a client can retrieve an IUIAutomationSynchronizedInputPattern interface from the element. + /// + UIA_IsSynchronizedInputPatternAvailablePropertyId = 30110, + + /// + /// Identifies the IsTableItemPatternAvailable property, which indicates whether the TableItem control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationTableItemPattern interface from the element. + /// + UIA_IsTableItemPatternAvailablePropertyId = 30039, + + /// + /// Identifies the IsTablePatternAvailable property, which indicates whether the Table control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationTablePattern interface from the element. + /// + UIA_IsTablePatternAvailablePropertyId = 30038, + + /// + /// Identifies the IsTextChildPatternAvailable property, which indicates whether the TextChild control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationTextChildPattern interface from the element. Supported + /// starting with Windows 8. + /// + UIA_IsTextChildPatternAvailablePropertyId = 30136, + + /// + /// Identifies the IsTextEditPatternAvailable property, which indicates whether the TextEdit control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationTextEditPattern interface from the element. Supported starting + /// with Windows 8.1. + /// + UIA_IsTextEditPatternAvailablePropertyId = 30149, + + /// + /// Identifies the IsTextPatternAvailable property, which indicates whether the Text control pattern is available for the automation + /// element. If TRUE, a client can retrieve an IUIAutomationTextPattern interface from the element. + /// + UIA_IsTextPatternAvailablePropertyId = 30040, + + /// + /// Identifies the IsTextPattern2Available property, which indicates whether version two of the Text control pattern is available for + /// the automation element. If TRUE, a client can retrieve an IUIAutomationTextPattern2 interface from the element. Supported + /// starting with Windows 8. + /// + UIA_IsTextPattern2AvailablePropertyId = 30119, + + /// + /// Identifies the IsTogglePatternAvailable property, which indicates whether the Toggle control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationTogglePattern interface from the element. + /// + UIA_IsTogglePatternAvailablePropertyId = 30041, + + /// + /// Identifies the IsTransformPatternAvailable property, which indicates whether the Transform control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationTransformPattern interface from the element. + /// + UIA_IsTransformPatternAvailablePropertyId = 30042, + + /// + /// Identifies the IsTransformPattern2Available property, which indicates whether version two of the Transform control pattern is + /// available for the automation element. If TRUE, a client can retrieve an IUIAutomationTransformPattern2 interface from the + /// element. Supported starting with Windows 8. + /// + UIA_IsTransformPattern2AvailablePropertyId = 30134, + + /// + /// Identifies the IsValuePatternAvailable property, which indicates whether the Value control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationValuePattern interface from the element. + /// + UIA_IsValuePatternAvailablePropertyId = 30043, + + /// + /// Identifies the IsVirtualizedItemPatternAvailable property, which indicates whether the VirtualizedItem control pattern is + /// available for the automation element. If TRUE, a client can retrieve an IUIAutomationVirtualizedItemPattern interface from the element. + /// + UIA_IsVirtualizedItemPatternAvailablePropertyId = 30109, + + /// + /// Identifies the IsWindowPatternAvailable property, which indicates whether the Window control pattern is available for the + /// automation element. If TRUE, a client can retrieve an IUIAutomationWindowPattern interface from the element. + /// + UIA_IsWindowPatternAvailablePropertyId = 30044, + } + + /// Describes the named constants used to identify text attributes of a Microsoft UI Automation text range. + [PInvokeData("UIAutomationClient.h")] + public enum TEXTATTRIBUTEID + { + /// + /// Identifies the AfterParagraphSpacing text attribute, which specifies the size of spacing after the paragraph. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_AfterParagraphSpacingAttributeId = 40042, + + /// + /// Identifies the AnimationStyle text attribute, which specifies the type of animation applied to the text. This attribute is + /// specified as a value from the AnimationStyle enumerated type. + /// Variant type: VT_I4 + /// Default value: AnimationStyle_None + /// + UIA_AnimationStyleAttributeId = 40000, + + /// + /// Identifies the AnnotationObjects text attribute, which maintains an array of IUIAutomationElement2 interfaces, one for each + /// element in the current text range that implements the Annotation control pattern. Each element might also implement other control + /// patterns as needed to describe the annotation. For example, an annotation that is a comment would also support the Text control + /// pattern. Supported starting with Windows 8. + /// Variant type: VT_UNKNOWN + /// Default value: empty array + /// + UIA_AnnotationObjectsAttributeId = 40032, + + /// + /// Identifies the AnnotationTypes text attribute, which maintains a list of annotation type identifiers for a range of text. For a + /// list of possible values, see Annotation Type Identifiers. Supported starting with Windows 8. + /// Variant type: VT_ARRAY + /// VT_I4 + /// Default value: empty array + /// + UIA_AnnotationTypesAttributeId = 40031, + + /// + /// Identifies the BackgroundColor text attribute, which specifies the background color of the text. This attribute is specified as a + /// COLORREF; a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_BackgroundColorAttributeId = 40001, + + /// + /// Identifies the BeforeParagraphSpacing text attribute, which specifies the size of spacing before the paragraph. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_BeforeParagraphSpacingAttributeId = 40041, + + /// + /// Identifies the BulletStyle text attribute, which specifies the style of bullets used in the text range. This attribute is + /// specified as a value from the BulletStyle enumerated type. + /// Variant type: VT_I4 + /// Default value: BulletStyle_None + /// + UIA_BulletStyleAttributeId = 40002, + + /// + /// Identifies the CapStyle text attribute, which specifies the capitalization style for the text. This attribute is specified as a + /// value from the CapStyle enumerated type. + /// Variant type: VT_I4 + /// Default value: CapStyle_None + /// + UIA_CapStyleAttributeId = 40003, + + /// + /// Identifies the CaretBidiMode text attribute, which indicates the direction of text flow in the text range. This attribute is + /// specified as a value from the CaretBidiMode enumerated type. Supported starting with Windows 8. + /// Variant type: VT_I4 + /// Default value: CaretBidiMode_LTR + /// + UIA_CaretBidiModeAttributeId = 40039, + + /// + /// Identifies the CaretPosition text attribute, which indicates whether the caret is at the beginning or the end of a line of text + /// in the text range. This attribute is specified as a value from the CaretPosition enumerated type. Supported starting with Windows 8. + /// Variant type: VT_I4 + /// Default value: CaretPosition_Unknown + /// + UIA_CaretPositionAttributeId = 40038, + + /// + /// Identifies the Culture text attribute, which specifies the locale of the text by locale identifier (LCID). + /// Variant type: VT_I4 + /// Default value: locale of the application UI + /// + UIA_CultureAttributeId = 40004, + + /// + /// Identifies the FontName text attribute, which specifies the name of the font. Examples: "Arial Black"; "Arial Narrow". The font + /// name string is not localized. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_FontNameAttributeId = 40005, + + /// + /// Identifies the FontSize text attribute, which specifies the point size of the font. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_FontSizeAttributeId = 40006, + + /// + /// Identifies the FontWeight text attribute, which specifies the relative stroke, thickness, or boldness of the font. The FontWeight + /// attribute is modeled after the lfWeight member of the GDI LOGFONT structure, and related standards, and can be one of the + /// following values: + /// 0 = DontCare + /// 100 = Thin + /// 200 = ExtraLight or UltraLight + /// 300 = Light + /// 400 = Normal or Regular + /// 500 = Medium + /// 600 = SemiBold + /// 700 = Bold + /// 800 = ExtraBold or UltraBold + /// 900 = Heavy or Black + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_FontWeightAttributeId = 40007, + + /// + /// Identifies the ForegroundColor text attribute, which specifies the foreground color of the text. This attribute is specified as a + /// COLORREF, a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_ForegroundColorAttributeId = 40008, + + /// + /// Identifies the HorizontalTextAlignment text attribute, which specifies how the text is aligned horizontally. This attribute is + /// specified as a value from the HorizontalTextAlignmentEnum enumerated type. + /// Variant type: VT_I4 + /// Default value: HorizontalTextAlignment_Left + /// + UIA_HorizontalTextAlignmentAttributeId = 40009, + + /// + /// Identifies the IndentationFirstLine text attribute, which specifies how far, in points, to indent the first line of a paragraph. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_IndentationFirstLineAttributeId = 40010, + + /// + /// Identifies the IndentationLeading text attribute, which specifies the leading indentation, in points. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_IndentationLeadingAttributeId = 40011, + + /// + /// Identifies the IndentationTrailing text attribute, which specifies the trailing indentation, in points. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_IndentationTrailingAttributeId = 40012, + + /// + /// Identifies the IsActive text attribute, which indicates whether the control that contains the text range has the keyboard focus + /// (TRUE) or not (FALSE). Supported starting with Windows 8. + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsActiveAttributeId = 40036, + + /// + /// Identifies the IsHidden text attribute, which indicates whether the text is hidden (TRUE) or visible (FALSE). + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsHiddenAttributeId = 40013, + + /// + /// Identifies the IsItalic text attribute, which indicates whether the text is italic (TRUE) or not (FALSE). + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsItalicAttributeId = 40014, + + /// + /// Identifies the IsReadOnly text attribute, which indicates whether the text is read-only (TRUE) or can be modified (FALSE). + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsReadOnlyAttributeId = 40015, + + /// + /// Identifies the IsSubscript text attribute, which indicates whether the text is subscript (TRUE) or not (FALSE). + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsSubscriptAttributeId = 40016, + + /// + /// Identifies the IsSuperscript text attribute, which indicates whether the text is subscript (TRUE) or not (FALSE). + /// Variant type: VT_BOOL + /// Default value: FALSE + /// + UIA_IsSuperscriptAttributeId = 40017, + + /// + /// Identifies the LineSpacing text attribute, which specifies the spacing between lines of text. + /// Variant type: VT_BSTR + /// Default value: "LineSpacingAttributeDefault" + /// + UIA_LineSpacingAttributeId = 40040, + + /// + /// Identifies the Link text attribute, which contains the IUIAutomationTextRange interface of the text range that is the target of + /// an internal link in a document. Supported starting with Windows 8. + /// Variant type: VT_UNKNOWN + /// Default value: NULL + /// + UIA_LinkAttributeId = 40035, + + /// + /// Identifies the MarginBottom text attribute, which specifies the size, in points, of the bottom margin applied to the page + /// associated with the text range. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_MarginBottomAttributeId = 40018, + + /// + /// Identifies the MarginLeading text attribute, which specifies the size, in points, of the leading margin applied to the page + /// associated with the text range. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_MarginLeadingAttributeId = 40019, + + /// + /// Identifies the MarginTop text attribute, which specifies the size, in points, of the top margin applied to the page associated + /// with the text range. + /// Variant type: VT_R8 + /// Ddefault value: 0 + /// + UIA_MarginTopAttributeId = 40020, + + /// + /// Identifies the MarginTrailing text attribute, which specifies the size, in points, of the trailing margin applied to the page + /// associated with the text range. + /// Variant type: VT_R8 + /// Default value: 0 + /// + UIA_MarginTrailingAttributeId = 40021, + + /// + /// Identifies the OutlineStyles text attribute, which specifies the outline style of the text. This attribute is specified as a + /// value from the OutlineStyles enumerated type. + /// Variant type: VT_I4 + /// Default value: OutlineStyles_None + /// + UIA_OutlineStylesAttributeId = 40022, + + /// + /// Identifies the OverlineColor text attribute, which specifies the color of the overline text decoration. This attribute is + /// specified as a COLORREF, a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_OverlineColorAttributeId = 40023, + + /// + /// Identifies the OverlineStyle text attribute, which specifies the style of the overline text decoration. This attribute is + /// specified as a value from the TextDecorationLineStyleEnum enumerated type. + /// Variant type: VT_I4 + /// Default value: TextDecorationLineStyle_None + /// + UIA_OverlineStyleAttributeId = 40024, + + /// + /// Identifies the SelectionActiveEnd text attribute, which indicates the location of the caret relative to a text range that + /// represents the currently selected text. This attribute is specified as a value from the ActiveEnd enumeration. Supported starting + /// with Windows 8. + /// Variant type: VT_I4 + /// Default value: ActiveEnd_None + /// + UIA_SelectionActiveEndAttributeId = 40037, + + /// + /// Identifies the StrikethroughColor text attribute, which specifies the color of the strikethrough text decoration. This attribute + /// is specified as a COLORREF, a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_StrikethroughColorAttributeId = 40025, + + /// + /// Identifies the StrikethroughStyle text attribute, which specifies the style of the strikethrough text decoration. This attribute + /// is specified as a value from the TextDecorationLineStyleEnum enumerated type. + /// Variant type: VT_I4 + /// Default value: TextDecorationLineStyle_None + /// + UIA_StrikethroughStyleAttributeId = 40026, + + /// + /// Identifies the StyleId text attribute, which indicates the text styles in use for a text range. For a list of possible values, + /// see Style Identifiers. Supported starting with Windows 8. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_StyleIdAttributeId = 40034, + + /// + /// Identifies the StyleName text attribute, which identifies the localized name of the text style in use for a text range. Supported + /// starting with Windows 8. + /// Variant type: VT_BSTR + /// Default value: empty string + /// + UIA_StyleNameAttributeId = 40033, + + /// + /// Identifies the Tabs text attribute, which is an array specifying the tab stops for the text range. Each array element specifies a + /// distance, in points, from the leading margin. + /// Variant type: VT_ARRAY | VT_R8 + /// Default value: empty array + /// + UIA_TabsAttributeId = 40027, + + /// + /// Identifies the TextFlowDirections text attribute, which specifies the direction of text flow. This attribute is specified as a + /// combination of values from the FlowDirections enumerated type. + /// Variant type: VT_I4 + /// Default value: FlowDirections_Default + /// + UIA_TextFlowDirectionsAttributeId = 40028, + + /// + /// Identifies the UnderlineColor text attribute, which specifies the color of the underline text decoration. This attribute is + /// specified as a COLORREF, a 32-bit value used to specify an RGB or RGBA color. + /// Variant type: VT_I4 + /// Default value: 0 + /// + UIA_UnderlineColorAttributeId = 40029, + + /// + /// Identifies the UnderlineStyle text attribute, which specifies the style of the underline text decoration. This attribute is + /// specified as a value from the TextDecorationLineStyleEnum enumerated type. + /// Variant type: VT_I4 + /// Default value: TextDecorationLineStyle_None + /// + UIA_UnderlineStyleAttributeId = 40030, + } +} \ No newline at end of file diff --git a/PInvoke/UIAutomation/UIAutomationCore.cs b/PInvoke/UIAutomation/UIAutomationCore.cs new file mode 100644 index 00000000..f5729b67 --- /dev/null +++ b/PInvoke/UIAutomation/UIAutomationCore.cs @@ -0,0 +1,5878 @@ +using Accessibility; +using System; +using System.Runtime.InteropServices; +using static Vanara.PInvoke.Oleacc; + +namespace Vanara.PInvoke; + +/// Items from the UIAutomationCore.dll. +public static partial class UIAutomationCore +{ + /// Contains values that specify the location of a docking window represented by the Dock control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-dockposition typedef enum DockPosition { + // DockPosition_Top = 0, DockPosition_Left = 1, DockPosition_Bottom = 2, DockPosition_Right = 3, DockPosition_Fill = 4, DockPosition_None + // = 5 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.DockPosition")] + public enum DockPosition + { + /// + /// Value: + /// 0 + /// The window is docked at the top. + /// + DockPosition_Top = 0, + + /// + /// Value: + /// 1 + /// The window is docked at the left. + /// + DockPosition_Left, + + /// + /// Value: + /// 2 + /// The window is docked at the bottom. + /// + DockPosition_Bottom, + + /// + /// Value: + /// 3 + /// The window is docked at the right. + /// + DockPosition_Right, + + /// + /// Value: + /// 4 + /// The window is docked on all four sides. + /// + DockPosition_Fill, + + /// + /// Value: + /// 5 + /// The window is not docked. + /// + DockPosition_None, + } + + /// Contains values that specify the state of a UI element that can be expanded and collapsed. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-expandcollapsestate typedef enum + // ExpandCollapseState { ExpandCollapseState_Collapsed = 0, ExpandCollapseState_Expanded = 1, ExpandCollapseState_PartiallyExpanded = 2, + // ExpandCollapseState_LeafNode = 3 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.ExpandCollapseState")] + public enum ExpandCollapseState + { + /// + /// Value: + /// 0 + /// No children are visible. + /// + ExpandCollapseState_Collapsed = 0, + + /// + /// Value: + /// 1 + /// All children are visible. + /// + ExpandCollapseState_Expanded, + + /// + /// Value: + /// 2 + /// Some, but not all, children are visible. + /// + ExpandCollapseState_PartiallyExpanded, + + /// + /// Value: + /// 3 + /// The element does not expand or collapse. + /// + ExpandCollapseState_LeafNode, + } + + /// Contains values used to specify the direction of navigation within the Microsoft UI Automation tree. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-navigatedirection typedef enum + // NavigateDirection { NavigateDirection_Parent = 0, NavigateDirection_NextSibling = 1, NavigateDirection_PreviousSibling = 2, + // NavigateDirection_FirstChild = 3, NavigateDirection_LastChild = 4 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.NavigateDirection")] + public enum NavigateDirection + { + /// + /// Value: + /// 0 + /// The navigation direction is to the parent. + /// + NavigateDirection_Parent = 0, + + /// + /// Value: + /// 1 + /// The navigation direction is to the next sibling. + /// + NavigateDirection_NextSibling, + + /// + /// Value: + /// 2 + /// The navigation direction is to the previous sibling. + /// + NavigateDirection_PreviousSibling, + + /// + /// Value: + /// 3 + /// The navigation direction is to the first child. + /// + NavigateDirection_FirstChild, + + /// + /// Value: + /// 4 + /// The navigation direction is to the last child. + /// + NavigateDirection_LastChild, + } + + /// + /// Contains values that specify the type of UI Automation provider. The IRawElementProviderSimple::ProviderOptions property uses this enumeration. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-provideroptions typedef enum ProviderOptions + // { ProviderOptions_ClientSideProvider = 0x1, ProviderOptions_ServerSideProvider = 0x2, ProviderOptions_NonClientAreaProvider = 0x4, + // ProviderOptions_OverrideProvider = 0x8, ProviderOptions_ProviderOwnsSetFocus = 0x10, ProviderOptions_UseComThreading = 0x20, + // ProviderOptions_RefuseNonClientSupport = 0x40, ProviderOptions_HasNativeIAccessible = 0x80, ProviderOptions_UseClientCoordinates = + // 0x100 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.ProviderOptions")] + [Flags] + public enum ProviderOptions + { + /// + /// Value: + /// 0x1 + /// The provider is a client-side (proxy) provider. + /// + ProviderOptions_ClientSideProvider = 1, + + /// + /// Value: + /// 0x2 + /// The provider is a server-side provider. + /// + ProviderOptions_ServerSideProvider = 2, + + /// + /// Value: + /// 0x4 + /// The provider is a non-client-area provider. + /// + ProviderOptions_NonClientAreaProvider = 4, + + /// + /// Value: + /// 0x8 + /// The provider overrides another provider. + /// + ProviderOptions_OverrideProvider = 8, + + /// + /// Value: + /// 0x10 + /// + /// The provider handles its own focus, and does not want UI Automation to set focus to the nearest window on its behalf. This option + /// is typically used by providers for windows that appear to take focus without actually receiving Win32 focus, such as menus and drop-downs. + /// + /// + ProviderOptions_ProviderOwnsSetFocus = 16, + + /// + /// Value: + /// 0x20 + /// + /// The provider has explicit support for COM threading models, so that calls by UI Automation on COM-based providers are received on + /// the appropriate thread. This means that STA-based provider implementations will be called back on their own STA thread, and + /// therefore do not need extra synchronization to safely access resources that belong to that STA. MTA-based provider + /// implementations will be called back on some other thread in the MTA, and will require appropriate synchronization to be added, as + /// is usual for MTA code. + /// + /// + ProviderOptions_UseComThreading = 32, + + /// + /// Value: + /// 0x40 + /// + /// The provider handles its own non-client area and does not want UI Automation to provide default accessibility support for + /// controls in the non-client area, such as minimize/maximize buttons and menu bars. + /// + /// + ProviderOptions_RefuseNonClientSupport = 64, + + /// + /// Value: + /// 0x80 + /// The provider implements the + /// IAccessible + /// interface. + /// + ProviderOptions_HasNativeIAccessible = 128, + + /// + /// Value: + /// 0x100 + /// The provider works in client coordinates instead of screen coordinates. + /// + ProviderOptions_UseClientCoordinates = 256, + } + + /// Contains values that specify whether data in a table should be read primarily by row or by column. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-roworcolumnmajor typedef enum + // RowOrColumnMajor { RowOrColumnMajor_RowMajor = 0, RowOrColumnMajor_ColumnMajor = 1, RowOrColumnMajor_Indeterminate = 2 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.RowOrColumnMajor")] + public enum RowOrColumnMajor + { + /// + /// Value: + /// 0 + /// Data in the table should be read row by row. + /// + RowOrColumnMajor_RowMajor, + + /// + /// Value: + /// 1 + /// Data in the table should be read column by column. + /// + RowOrColumnMajor_ColumnMajor, + + /// + /// Value: + /// 2 + /// The best way to present the data is indeterminate. + /// + RowOrColumnMajor_Indeterminate, + } + + /// Contains values that specify the direction and distance to scroll. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-scrollamount typedef enum ScrollAmount { + // ScrollAmount_LargeDecrement = 0, ScrollAmount_SmallDecrement = 1, ScrollAmount_NoAmount = 2, ScrollAmount_LargeIncrement = 3, + // ScrollAmount_SmallIncrement = 4 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.ScrollAmount")] + public enum ScrollAmount + { + /// + /// Value: + /// 0 + /// + /// Scrolling is done in large decrements, equivalent to pressing the PAGE UP key or clicking on a blank part of a scroll bar. If one + /// page up is not a relevant amount for the control and no scroll bar exists, the value represents an amount equal to the current + /// visible window. + /// + /// + ScrollAmount_LargeDecrement, + + /// + /// Value: + /// 1 + /// Scrolling is done in small decrements, equivalent to pressing an arrow key or clicking the arrow button on a scroll bar. + /// + ScrollAmount_SmallDecrement, + + /// + /// Value: + /// 2 + /// No scrolling is done. + /// + ScrollAmount_NoAmount, + + /// + /// Value: + /// 3 + /// + /// Scrolling is done in large increments, equivalent to pressing the PAGE DOWN or PAGE UP key or clicking on a blank part of a + /// scroll bar. + /// + /// + /// If one page is not a relevant amount for the control and no scroll bar exists, the value represents an amount equal to the + /// current visible window. + /// + /// + ScrollAmount_LargeIncrement, + + /// + /// Value: + /// 4 + /// Scrolling is done in small increments, equivalent to pressing an arrow key or clicking the arrow + /// button on a scroll bar. + /// + ScrollAmount_SmallIncrement, + } + + /// Contains values that specify the type of change in the Microsoft UI Automation tree structure. + /// + /// + /// Because the implementation of structure-change events depends on the underlying UI framework, UI Automation defines no strict rule + /// governing when a provider must switch from sending individual ChildAdded or ChildRemoved events to the bulk equivalent. However, the + /// switch typically occurs when two to five child elements are added or removed at once. The bulk events help to prevent clients from + /// being flooded by individual ChildAdded and ChildRemoved events. + /// + /// + /// Except for ChildAdded, structure-change events are always associated with the container element that holds the children. The + /// ChildAdded event is associated with the element that was just added. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-structurechangetype typedef enum + // StructureChangeType { StructureChangeType_ChildAdded = 0, StructureChangeType_ChildRemoved, StructureChangeType_ChildrenInvalidated, + // StructureChangeType_ChildrenBulkAdded, StructureChangeType_ChildrenBulkRemoved, StructureChangeType_ChildrenReordered } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.StructureChangeType")] + public enum StructureChangeType + { + /// + /// Value: + /// 0 + /// A child element was added to the UI Automation element tree. + /// + StructureChangeType_ChildAdded, + + /// A child element was removed from the UI Automation element tree. + StructureChangeType_ChildRemoved, + + /// + /// Child elements were invalidated in the UI Automation element tree. This might mean that one or more child elements were added or + /// removed, or a combination of both. This value can also indicate that one subtree in the UI was substituted for another. For + /// example, the entire contents of a dialog box changed at once, or the view of a list changed because an Explorer-type application + /// navigated to another location. The exact meaning depends on the UI Automation provider implementation. + /// + StructureChangeType_ChildrenInvalidated, + + /// Child elements were added in bulk to the UI Automation element tree. + StructureChangeType_ChildrenBulkAdded, + + /// Child elements were removed in bulk from the UI Automation element tree. + StructureChangeType_ChildrenBulkRemoved, + + /// + /// The order of child elements has changed in the UI Automation element tree. Child elements may or may not have been added or removed. + /// + StructureChangeType_ChildrenReordered, + } + + /// Contains values that specify the supported text selection attribute. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-supportedtextselection typedef enum + // SupportedTextSelection { SupportedTextSelection_None = 0, SupportedTextSelection_Single = 1, SupportedTextSelection_Multiple = 2 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.SupportedTextSelection")] + public enum SupportedTextSelection + { + /// + /// Value: + /// 0 + /// Does not support text selections. + /// + SupportedTextSelection_None, + + /// + /// Value: + /// 1 + /// Supports a single, continuous text selection. + /// + SupportedTextSelection_Single, + + /// + /// Value: + /// 2 + /// Supports multiple, disjoint text selections. + /// + SupportedTextSelection_Multiple, + } + + /// Contains values that specify the type of synchronized input. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-synchronizedinputtype typedef enum + // SynchronizedInputType { SynchronizedInputType_KeyUp = 0x1, SynchronizedInputType_KeyDown = 0x2, SynchronizedInputType_LeftMouseUp = + // 0x4, SynchronizedInputType_LeftMouseDown = 0x8, SynchronizedInputType_RightMouseUp = 0x10, SynchronizedInputType_RightMouseDown = 0x20 + // } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.SynchronizedInputType")] + [Flags] + public enum SynchronizedInputType + { + /// + /// Value: + /// 0x1 + /// A key has been released. + /// + SynchronizedInputType_KeyUp = 1, + + /// + /// Value: + /// 0x2 + /// A key has been pressed. + /// + SynchronizedInputType_KeyDown = 2, + + /// + /// Value: + /// 0x4 + /// The left mouse button has been released. + /// + SynchronizedInputType_LeftMouseUp = 4, + + /// + /// Value: + /// 0x8 + /// The left mouse button has been pressed. + /// + SynchronizedInputType_LeftMouseDown = 8, + + /// + /// Value: + /// 0x10 + /// The right mouse button has been released. + /// + SynchronizedInputType_RightMouseUp = 16, + + /// + /// Value: + /// 0x20 + /// The right mouse button has been pressed. + /// + SynchronizedInputType_RightMouseDown = 32, + } + + /// Contains values that specify the endpoints of a text range. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-textpatternrangeendpoint typedef enum + // TextPatternRangeEndpoint { TextPatternRangeEndpoint_Start = 0, TextPatternRangeEndpoint_End = 1 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.TextPatternRangeEndpoint")] + public enum TextPatternRangeEndpoint + { + /// + /// Value: + /// 0 + /// The starting endpoint of the range. + /// + TextPatternRangeEndpoint_Start, + + /// + /// Value: + /// 1 + /// The ending endpoint of the range. + /// + TextPatternRangeEndpoint_End, + } + + /// Contains values that specify units of text for the purposes of navigation. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-textunit typedef enum TextUnit { + // TextUnit_Character = 0, TextUnit_Format = 1, TextUnit_Word = 2, TextUnit_Line = 3, TextUnit_Paragraph = 4, TextUnit_Page = 5, + // TextUnit_Document = 6 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.TextUnit")] + public enum TextUnit + { + /// + /// Value: + /// 0 + /// Character. + /// + TextUnit_Character, + + /// + /// Value: + /// 1 + /// Format. + /// + TextUnit_Format, + + /// + /// Value: + /// 2 + /// Word. + /// + TextUnit_Word, + + /// + /// Value: + /// 3 + /// Line. + /// + TextUnit_Line, + + /// + /// Value: + /// 4 + /// Paragraph. + /// + TextUnit_Paragraph, + + /// + /// Value: + /// 5 + /// Page. + /// + TextUnit_Page, + + /// + /// Value: + /// 6 + /// Document. + /// + TextUnit_Document, + } + + /// + /// Contains values that specify the toggle state of a Microsoft UI Automation element that implements the Toggle control pattern. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-togglestate typedef enum ToggleState { + // ToggleState_Off = 0, ToggleState_On = 1, ToggleState_Indeterminate = 2 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.ToggleState")] + public enum ToggleState + { + /// + /// Value: + /// 0 + /// The UI Automation element is not selected, checked, marked or otherwise activated. + /// + ToggleState_Off, + + /// + /// Value: + /// 1 + /// The UI Automation element is selected, checked, marked or otherwise activated. + /// + ToggleState_On, + + /// + /// Value: + /// 2 + /// The UI Automation element is in an indeterminate state. + /// The Indeterminate property can be used to indicate whether the user has acted + /// on a control. For example, a check box can appear checked and dimmed, indicating an indeterminate state. + /// Creating an indeterminate state is different from disabling the control. + /// Consequently, a check box in the indeterminate state can still receive the focus. + /// When the user clicks an indeterminate control the ToggleState cycles to its next value. + /// + ToggleState_Indeterminate, + } + + /// Contains values used to indicate Microsoft UI Automation data types. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-uiautomationtype typedef enum + // UIAutomationType { UIAutomationType_Int = 0x1, UIAutomationType_Bool = 0x2, UIAutomationType_String = 0x3, UIAutomationType_Double = + // 0x4, UIAutomationType_Point = 0x5, UIAutomationType_Rect = 0x6, UIAutomationType_Element = 0x7, UIAutomationType_Array = 0x10000, + // UIAutomationType_Out = 0x20000, UIAutomationType_IntArray, UIAutomationType_BoolArray, UIAutomationType_StringArray, + // UIAutomationType_DoubleArray, UIAutomationType_PointArray, UIAutomationType_RectArray, UIAutomationType_ElementArray, + // UIAutomationType_OutInt, UIAutomationType_OutBool, UIAutomationType_OutString, UIAutomationType_OutDouble, UIAutomationType_OutPoint, + // UIAutomationType_OutRect, UIAutomationType_OutElement, UIAutomationType_OutIntArray, UIAutomationType_OutBoolArray, + // UIAutomationType_OutStringArray, UIAutomationType_OutDoubleArray, UIAutomationType_OutPointArray, UIAutomationType_OutRectArray, + // UIAutomationType_OutElementArray } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.UIAutomationType")] + public enum UIAutomationType + { + /// + /// Value: + /// 0x1 + /// An integer. + /// + UIAutomationType_Int = 1, + + /// + /// Value: + /// 0x2 + /// An Boolean value. + /// + UIAutomationType_Bool, + + /// + /// Value: + /// 0x3 + /// A null-terminated character string. + /// + UIAutomationType_String, + + /// + /// Value: + /// 0x4 + /// A double-precision floating-point number. + /// + UIAutomationType_Double, + + /// + /// Value: + /// 0x5 + /// A + /// POINT + /// structure containing the x- and y-coordinates of a point. + /// + UIAutomationType_Point, + + /// + /// Value: + /// 0x6 + /// A + /// RECT + /// + /// structure containing the coordinates of the upper-left and lower-right corners of a rectangle. This type is not supported for a + /// custom UI Automation property. + /// + /// + UIAutomationType_Rect, + + /// + /// Value: + /// 0x7 + /// The address of the + /// IUIAutomationElement + /// interface of a UI Automation element. + /// + UIAutomationType_Element, + + /// + /// Value: + /// 0x10000 + /// An array of an unspecified type. + /// + UIAutomationType_Array = 65536, + + /// An array of integers. This type is not supported for a custom UI Automation property. + UIAutomationType_IntArray, + + /// An array of Boolean values. This type is not supported for a custom UI Automation property. + UIAutomationType_BoolArray, + + /// An array of null-terminated character strings. This type is not supported for a custom UI Automation property. + UIAutomationType_StringArray, + + /// An array of double-precision floating-point numbers. This type is not supported for a custom UI Automation property. + UIAutomationType_DoubleArray, + + /// + /// An array of + /// POINT + /// + /// structures, each containing the x- and y-coordinates of a point. This type is not supported for a custom UI Automation property. + /// + /// + UIAutomationType_PointArray, + + /// + /// An array of + /// RECT + /// + /// structures, each containing the coordinates of the upper-left and lower-right corners of a rectangle. This type is not supported + /// for a custom UI Automation property. + /// + /// + UIAutomationType_RectArray, + + /// + /// An array of pointers to + /// IUIAutomationElement + /// interfaces, each for a UI Automation element. + /// + UIAutomationType_ElementArray, + + /// + /// Value: + /// 0x20000 + /// The address of a variable that receives a value retrieved by a function. + /// + UIAutomationType_Out = 0x20000, + + /// The address of a variable that receives an integer value. + UIAutomationType_OutInt, + + /// The address of a variable that receives a Boolean value. + UIAutomationType_OutBool, + + /// The address of a variable that receives a null-terminated character string. + UIAutomationType_OutString, + + /// The address of a variable that receives a double-precision floating-point number. + UIAutomationType_OutDouble, + + /// + /// The address of a variable that receives a + /// POINT + /// structure. + /// + UIAutomationType_OutPoint, + + /// + /// The address of a variable that receives a + /// RECT + /// structure. + /// + UIAutomationType_OutRect, + + /// + /// The address of a variable that receives a pointer to the + /// IUIAutomationElement + /// interface of a UI Automation element. + /// + UIAutomationType_OutElement, + + /// The address of a variable that receives an array of integer values. + UIAutomationType_OutIntArray = 196609, + + /// The address of a variable that receives an array of Boolean values. + UIAutomationType_OutBoolArray, + + /// The address of a variable that receives an array of null-terminated character strings. + UIAutomationType_OutStringArray, + + /// The address of a variable that receives an array of double-precision floating-point numbers. + UIAutomationType_OutDoubleArray, + + /// + /// The address of a variable that receives an array of + /// POINT + /// structures. + /// + UIAutomationType_OutPointArray, + + /// + /// The address of a variable that receives an array of + /// RECT + /// structures. + /// + UIAutomationType_OutRectArray, + + /// + /// The address of a variable that receives an array of pointers to the + /// IUIAutomationElement + /// interfaces of UI Automation elements. + /// + UIAutomationType_OutElementArray, + } + + /// Contains values that specify the current state of the window for purposes of user interaction. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-windowinteractionstate typedef enum + // WindowInteractionState { WindowInteractionState_Running = 0, WindowInteractionState_Closing = 1, + // WindowInteractionState_ReadyForUserInteraction = 2, WindowInteractionState_BlockedByModalWindow = 3, + // WindowInteractionState_NotResponding = 4 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.WindowInteractionState")] + public enum WindowInteractionState + { + /// + /// Value: + /// 0 + /// The window is running. This does not guarantee that the window is ready for user interaction or is responding. + /// + WindowInteractionState_Running, + + /// + /// Value: + /// 1 + /// The window is closing. + /// + WindowInteractionState_Closing, + + /// + /// Value: + /// 2 + /// The window is ready for user interaction. + /// + WindowInteractionState_ReadyForUserInteraction, + + /// + /// Value: + /// 3 + /// The window is blocked by a modal window. + /// + WindowInteractionState_BlockedByModalWindow, + + /// + /// Value: + /// 4 + /// The window is not responding. + /// + WindowInteractionState_NotResponding, + } + + /// Contains values that specify the visual state of a window. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-windowvisualstate typedef enum + // WindowVisualState { WindowVisualState_Normal = 0, WindowVisualState_Maximized = 1, WindowVisualState_Minimized = 2 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.WindowVisualState")] + public enum WindowVisualState + { + /// + /// Value: + /// 0 + /// The window is normal (restored). + /// + WindowVisualState_Normal, + + /// + /// Value: + /// 1 + /// The window is maximized. + /// + WindowVisualState_Maximized, + + /// + /// Value: + /// 2 + /// The window is minimized. + /// + WindowVisualState_Minimized, + } + + /// + /// Contains possible values for the IUIAutomationTransformPattern2::ZoomByUnit method, which zooms the viewport of a control by the + /// specified unit. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-zoomunit typedef enum ZoomUnit { + // ZoomUnit_NoAmount = 0, ZoomUnit_LargeDecrement = 1, ZoomUnit_SmallDecrement = 2, ZoomUnit_LargeIncrement = 3, ZoomUnit_SmallIncrement + // = 4 } ; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NE:uiautomationcore.ZoomUnit")] + public enum ZoomUnit + { + /// + /// Value: + /// 0 + /// No increase or decrease in zoom. + /// + ZoomUnit_NoAmount, + + /// + /// Value: + /// 1 + /// Decrease zoom by a large decrement. + /// + ZoomUnit_LargeDecrement, + + /// + /// Value: + /// 2 + /// Decrease zoom by a small decrement. + /// + ZoomUnit_SmallDecrement, + + /// + /// Value: + /// 3 + /// Increase zoom by a large increment. + /// + ZoomUnit_LargeIncrement, + + /// + /// Value: + /// 4 + /// Increase zoom by a small increment. + /// + ZoomUnit_SmallIncrement, + } + + /// + /// + /// Controls that do not have a Microsoft UI Automation provider, but that implement IAccessible, can easily be upgraded to + /// provide some UI Automation functionality by implementing the IAccessibleEx interface. This interface enables the control to + /// expose UI Automation properties and control patterns, without the need for a full implementation of UI Automation provider interfaces + /// such as IRawElementProviderFragment. To use IAccessibleEx, IRawElementProviderFragment, and all other UI + /// Automation interfaces, include the UIAutomation.h header file in your source code. + /// + /// + /// For example, consider a custom control that has a range value. The Microsoft Active Accessibility server for the control defines the + /// control's role and is able to return its current value. However, because Microsoft Active Accessibility does not define minimum and + /// maximum properties, the server lacks the means to return the minimum and maximum values of the control. A UI Automation client is + /// able to retrieve the control's role, current value, and other Microsoft Active Accessibility properties, because the UI Automation + /// core can obtain these through IAccessible. However, without access to an IRangeValueProvider interface on the object, + /// UI Automation is also unable to retrieve the maximum and minimum values. + /// + /// + /// The control developer could supply a complete UI Automation provider for the control, but this would mean duplicating much of the + /// existing functionality of the IAccessible implementation: for example, navigation and common properties. Instead, the + /// developer can continue to rely on IAccessible to supply this functionality, while adding support for control-specific + /// properties through IRangeValueProvider. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/winauto/iaccessibleex + [PInvokeData("")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f8b80ada-2c44-48d0-89be-5ff23c9cd875")] + public interface IAccessibleEx + { + /// Retrieves an IAccessibleEx interface representing the specified child of this element. + /// + /// Type: long + /// The identifier of the child element. + /// + /// + /// Type: IAccessibleEx** + /// Receives a pointer to the IAccessibleEx interface. + /// + /// + /// + /// pRetVal returns NULL if this implementation does not use child IDs, or cannot provide an IAccessibleEx interface + /// for the specified child, or itself represents a child element. + /// + /// idChild must represent an actual MSAA child element, not an object that has its own IAccessible interface. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iaccessibleex-getobjectforchild HRESULT + // GetObjectForChild( [in] long idChild, [out] IAccessibleEx **pRetVal ); + IAccessibleEx GetObjectForChild(int idChild); + + /// Retrieves the IAccessible interface and child ID for this item. + /// + /// Type: IAccessible** + /// Receives a pointer to the IAccessible interface for this object, or the parent object if this is a child element. + /// + /// + /// Type: long* + /// Receives the child ID, or CHILDID_SELF if this is not a child element. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iaccessibleex-getiaccessiblepair HRESULT + // GetIAccessiblePair( [out] IAccessible **ppAcc, [out] long *pidChild ); + void GetIAccessiblePair(out IAccessible ppAcc, out int pidChild); + + /// Retrieves the runtime identifier of this element. + /// + /// Type: SAFEARRAY** + /// Receives a pointer to the runtime identifier. + /// + /// + /// + /// The runtime identifier is a provider-defined array of integers, the first item of which must be UiaAppendRuntimeId. The + /// runtime identifier must be unique within the parent window. + /// + /// + /// The MSAA-to-UIA Proxy uses the runtime identifier (together with the window handle) to determine if two interface instances refer + /// to the same underlying element. If IAccessibleEx::GetRuntimeId is not implemented, the proxy performs field-by-field + /// comparisons on the two IAccessible objects to determine if they are equivalent, which is less efficient. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iaccessibleex-getruntimeid HRESULT + // GetRuntimeId( [out] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] + int[] GetRuntimeId(); + + /// Retrieves the IAccessibleEx interface of an element returned as a property value. + /// + /// Type: IRawElementProviderSimple* + /// Pointer to the IRawElementProviderSimple interface that was retrieved as a property. + /// + /// + /// Type: IAccessibleEx** + /// Receives a pointer to the IAccessibleEx interface of the element. + /// + /// + /// This method is implemented by the bridge between Microsoft UI Automation and Microsoft Active Accessibility. Most other + /// implementations should return E_NOTIMPL after setting ppRetValOut to NULL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iaccessibleex-convertreturnedelement + // HRESULT ConvertReturnedElement( [in] IRawElementProviderSimple *pIn, [out] IAccessibleEx **ppRetValOut ); + void ConvertReturnedElement(IRawElementProviderSimple pIn, out IAccessibleEx ppRetValOut); + } + + /// + /// A Microsoft Active Accessibility object implements this interface when the object is the root of an accessibility tree that includes + /// windowless Microsoft ActiveX controls that implement Microsoft UI Automation. Because Microsoft Active Accessibility and UI + /// Automation use different interfaces, this interface enables a client to discover the list of hosted windowless ActiveX controls that + /// support UI Automation in case the client needs to treat them differently. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iaccessiblehostingelementproviders + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IAccessibleHostingElementProviders")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("33ac331b-943e-4020-b295-db37784974a3")] + public interface IAccessibleHostingElementProviders + { + /// + /// Retrieves the Microsoft Active Accessibility providers of all windowless Microsoft ActiveX controls that have a Microsoft UI + /// Automation provider implementation, and are hosted in a Microsoft Active Accessibility object that implements the + /// IAccessibleHostingElementProviders interface. + /// + /// + /// Type: SAFEARRAY** + /// Receives the IRawElementProviderFragmentRoot interface pointers. + /// + /// + /// + /// The container of windowless ActiveX controls implements this method on the same object that implements the IAccessible interface. + /// When called, this method queries each of the contained windowless ActiveX controls for an IRawElementProviderFragmentRoot + /// pointer, and then adds the pointer to the safe array. + /// + /// This method should not include any providers that do not implement IRawElementProviderFragmentRoot. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iaccessiblehostingelementproviders-getembeddedfragmentroots + // HRESULT GetEmbeddedFragmentRoots( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderFragmentRoot[] GetEmbeddedFragmentRoots(); + + /// + /// Retrieves the object ID associated with a contained windowless Microsoft ActiveX control that implements Microsoft UI Automation. + /// + /// + /// Type: IRawElementProviderSimple* + /// The provider for the windowless ActiveX control. + /// + /// + /// Type: long* + /// The object ID of the contained windowless ActiveX control. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iaccessiblehostingelementproviders-getobjectidforprovider + // HRESULT GetObjectIdForProvider( [in, optional] IRawElementProviderSimple *pProvider, [out] long *pidObject ); + void GetObjectIdForProvider(IRawElementProviderSimple pProvider, out int pidObject); + } + + /// Exposes the properties of an annotation in a document. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iannotationprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IAnnotationProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f95c7e80-bd63-4601-9782-445ebff011fc")] + public interface IAnnotationProvider + { + /// + /// The annotation type identifier of this annotation. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iannotationprovider-get_annotationtypeid + // HRESULT get_AnnotationTypeId( int *retVal ); + int AnnotationTypeId { get; } + + /// + /// The name of this annotation type. + /// This property is read-only. + /// + /// + /// + /// The name of the annotation type can correspond to one of the annotation type identifiers (for example, “Comment” for + /// AnnotationType_Comment), but it is not required to. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iannotationprovider-get_annotationtypename + // HRESULT get_AnnotationTypeName( BSTR *retVal ); + string AnnotationTypeName { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// The name of the annotation author. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iannotationprovider-get_author HRESULT + // get_Author( BSTR *retVal ); + string Author { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// The date and time when this annotation was created. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iannotationprovider-get_datetime HRESULT + // get_DateTime( BSTR *retVal ); + string DateTime { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// The UI Automation element that is being annotated. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iannotationprovider-get_target HRESULT + // get_Target( IRawElementProviderSimple **retVal ); + IRawElementProviderSimple Target { [return: MarshalAs(UnmanagedType.IUnknown)] get; } + } + + /// Undocumented + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2062a28a-8c07-4b94-8e12-7037c622aeb8")] + public interface ICustomNavigationProvider + { + /// Navigates the specified direction. + /// The direction. + /// + IRawElementProviderSimple Navigate(NavigateDirection direction); + } + + /// Provides access to an element in a docking container. + /// + /// + /// IDockProvider does not expose any properties of the docking container or any properties of controls that might be docked + /// adjacent to the current control in the docking container. + /// + /// + /// Controls are docked relative to each other based on their current z-order; the higher their z-order placement, the farther they are + /// placed from the specified edge of the docking container. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-idockprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IDockProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("159bc72c-4ad3-485e-9637-d7052edf0146")] + public interface IDockProvider + { + /// Sets the docking position of this element. + /// + /// Type: DockPosition + /// The new docking position. + /// + /// + /// A docking container is a control that allows the arrangement of child elements, both horizontally and vertically, relative to the + /// boundaries of the docking container and other elements within the container. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idockprovider-setdockposition HRESULT + // SetDockPosition( [in] DockPosition dockPosition ); + void SetDockPosition(DockPosition dockPosition); + + /// + /// Indicates the current docking position of this element. + /// This property is read-only. + /// + /// + /// + /// + /// A docking container is a control that allows the arrangement of child elements, both horizontally and vertically, relative to the + /// boundaries of the docking container and other elements in the container. + /// + /// Examples + /// The following example shows how to return the DockPosition property. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idockprovider-get_dockposition HRESULT + // get_DockPosition( DockPosition *pRetVal ); + DockPosition DockPosition { get; } + } + + /// + /// Enables a Microsoft UI Automation element to describe itself as an element that can be dragged as part of a drag-and-drop operation. + /// + /// + /// A provider can implement IDragProvider only on the element being dragged, or it can use an intermediary drag object that + /// implements IDragProvider, in addition to the IDragProvider implementation on the individual element. The intermediary + /// is responsible for firing all events, which enables the provider to support dragging multiple elements at once, and to describe the + /// multi-element drag operation with a single set of drag properties and events. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-idragprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IDragProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6aa7bbbb-7ff9-497d-904f-d20b897929d8")] + public interface IDragProvider + { + /// Retrieves the collection of elements that are being dragged as part of a drag operation. + /// + /// An array of VT_UNKNOWN pointers to the IRawElementProviderSimple interfaces of the elements that are being dragged. This + /// parameter is NULL if only a single item is being dragged. + /// + /// + /// If the user is dragging multiple items, the items are represented by a single master element with an associated set of grabbed + /// elements. The master element raises the appropriate events, to avoid having a large set of duplicate events. The client can call + /// GetGrabbedItems to retrieve the full list of grabbed items. The provider should allocate a SAFEARRAY of appropriate length + /// and add the Component Object Model (COM) pointers of the elements that are part of the drag operation. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idragprovider-getgrabbeditems HRESULT + // GetGrabbedItems( [out, retval, optional] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetGrabbedItems(); + + /// + /// Indicates whether the element has been grabbed as part of a drag-and-drop operation. + /// This property is read-only. + /// + /// + /// + /// If this property changes, the provider must notify clients by calling UiaRaiseAutomationPropertyChangedEvent and specifying a + /// property identifier of UIA_DragIsGrabbedPropertyId or UIA_DragDropEffectPropertyId. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idragprovider-get_isgrabbed HRESULT + // get_IsGrabbed( BOOL *pRetVal ); + bool IsGrabbed { get; } + + /// + /// Retrieves a localized string that indicates what happens when this element is dropped as part of a drag-drop operation. + /// This property is read-only. + /// + /// + /// + /// + /// In the source-only style of UI Automation drag-and-drop, no elements implement the DropTarget pattern. To find out what effect + /// dropping the dragged element will have, a client can query the DropEffect property of the dragged element. This property + /// can be a short string such as "move", or a longer one, such as "insert into Main group". The string is always localized. + /// + /// + /// If this property changes, the provider must notify clients by calling UiaRaiseAutomationPropertyChangedEvent and specifying a + /// property identifier of UIA_DragIsGrabbedPropertyId or UIA_DragDropEffectPropertyId. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idragprovider-get_dropeffect HRESULT + // get_DropEffect( BSTR *pRetVal ); + string DropEffect { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// + /// Retrieves an array of localized strings that enumerate the full set of effects that can happen when this element is dropped as + /// part of a drag-and-drop operation. + /// + /// This property is read-only. + /// + /// + /// + /// Some drag operations support a set of different drop effects. For example, a drag operation initiated through a right-click might + /// display a menu of options when the element is dropped. In the source-only style of Microsoft UI Automation drag-and-drop, no + /// elements implement the DropTarget pattern. To find out what effect dropping the dragged element will have, a client can query the + /// DropEffect property of the dragged element. This property can be a short string such as "move", or a longer one, such as "insert + /// into Main group". The strings are always localized. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idragprovider-get_dropeffects HRESULT + // get_DropEffects( SAFEARRAY **pRetVal ); + string[] DropEffects { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)] get; } + } + + /// + /// Enables a Microsoft UI Automation element to describe itself as an element that can receive a drop of a dragged element as part of a + /// UI Automation drag-and-drop operation. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-idroptargetprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IDropTargetProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("bae82bfd-358a-481c-85a0-d8b4d90a5d61")] + public interface IDropTargetProvider + { + /// + /// + /// Retrieves a localized string that describes the effect that happens when the user drops the grabbed element on this drop target. + /// + /// This property is read-only. + /// + /// + /// + /// + /// This property describes the default effect that happens when the user drops a grabbed element on a target, such as moving or + /// copying the element. This property can be a short string such as "move", or a longer one such as "insert into Main group". The + /// string is always localized. + /// + /// If this property changes, the provider must notify clients by firing a UIA_AutomationPropertyChangedEventId event. + /// Examples + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idroptargetprovider-get_droptargeteffect + // HRESULT get_DropTargetEffect( BSTR *pRetVal ); + string DropTargetEffect { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// + /// Retrieves an array of localized strings that enumerate the full set of effects that can happen when the user drops a grabbed + /// element on this drop target as part of a drag-and-drop operation. + /// + /// This property is read-only. + /// + /// + /// + /// Some drag operations support a set of different drop effects. For example, a drag operation that is initiated with a right-click + /// might display a menu of options for the action that occurs when the element is dropped. To find out the set of effects that can + /// happen when the grabbed element is dropped, a client can query the DropEffects property of the dragged element. This property can + /// contain short strings such as "move", or longer ones such as "insert into Main group". The strings are always localized. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-idroptargetprovider-get_droptargeteffects + // HRESULT get_DropTargetEffects( SAFEARRAY **pRetVal ); + string[] DropTargetEffects { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)] get; } + } + + /// Provides access to a control that visually expands to display content, and collapses to hide content. + /// Implemented on a Microsoft UI Automation provider that must support the ExpandCollapse control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iexpandcollapseprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IExpandCollapseProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("d847d3a5-cab0-4a98-8c32-ecb45c59ad24")] + public interface IExpandCollapseProvider + { + /// Displays all child nodes, controls, or content of the control. + /// This is a blocking method that returns after the control has been expanded. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iexpandcollapseprovider-expand HRESULT Expand(); + void Expand(); + + /// Hides all child nodes, controls, or content of this element. + /// This is a blocking method that returns after the element has been collapsed. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iexpandcollapseprovider-collapse HRESULT Collapse(); + void Collapse(); + + /// + /// Indicates the state, expanded or collapsed, of the control. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iexpandcollapseprovider-get_expandcollapsestate + // HRESULT get_ExpandCollapseState( ExpandCollapseState *pRetVal ); + ExpandCollapseState ExpandCollapseState { get; } + } + + /// Provides access to individual child controls of containers that implement IGridProvider. + /// + /// Implemented on a UI Automation provider that must support the GridItem control pattern. + /// + /// Controls that implement IGridItemProvider can typically be traversed (that is, a UI Automation client can move to adjacent + /// controls) by using the keyboard. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-igriditemprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IGridItemProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("d02541f1-fb81-4d64-ae32-f520f8a6dbd1")] + public interface IGridItemProvider + { + /// + /// Specifies the ordinal number of the row that contains this cell or item. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igriditemprovider-get_row HRESULT + // get_Row( int *pRetVal ); + int Row { get; } + + /// + /// Specifies the ordinal number of the column that contains this cell or item. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igriditemprovider-get_column HRESULT + // get_Column( int *pRetVal ); + int Column { get; } + + /// + /// Specifies the number of rows spanned by this cell or item. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igriditemprovider-get_rowspan HRESULT + // get_RowSpan( int *pRetVal ); + int RowSpan { get; } + + /// + /// Specifies the number of columns spanned by this cell or item. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igriditemprovider-get_columnspan HRESULT + // get_ColumnSpan( int *pRetVal ); + int ColumnSpan { get; } + + /// + /// Specifies the UI Automation provider that implements IGridProvider and represents the container of this cell or item. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igriditemprovider-get_containinggrid + // HRESULT get_ContainingGrid( IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple ContainingGrid { [return: MarshalAs(UnmanagedType.IUnknown)] get; } + } + + /// + /// Provides access to controls that act as containers for a collection of child elements organized in a two-dimensional logical + /// coordinate system that can be traversed (that is, a Microsoft UI Automation client can move to adjacent controls) by using the + /// keyboard. The children of this element must implement IGridItemProvider. + /// + /// + /// + /// The IGridProvider interface exposes methods and properties to support UI Automation client access to controls that act as + /// containers for a collection of child elements. The children of this element must implement IGridItemProvider and be organized in a + /// two-dimensional logical coordinate system that can be traversed (that is, a UI Automation client can move to adjacent controls) by + /// using the keyboard. + /// + /// Implemented on a UI Automation provider that must support the Grid control pattern. + /// IGridProvider does not enable active manipulation of a grid; ITransformProvider must be implemented for this. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-igridprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IGridProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b17d6187-0907-464b-a168-0ef17a1572b1")] + public interface IGridProvider + { + /// Retrieves the Microsoft UI Automation provider for the specified cell. + /// + /// Type: int + /// The ordinal number of the row of interest. + /// + /// + /// Type: int + /// The ordinal number of the column of interest. + /// + /// + /// Type: IRawElementProviderSimple** + /// + /// Receives a pointer to a UI Automation provider for the specified cell or a null reference (Nothing in Microsoft Visual Basic + /// .NET) if the cell is empty. + /// + /// + /// + /// Grid coordinates are zero-based with the upper left (or upper right cell depending on locale) having coordinates (0,0). + /// + /// If a cell is empty a UI Automation provider must still be returned in order to support the ContainingGrid property for that cell. + /// This is possible when the layout of child elements in the grid is similar to a ragged array. + /// + /// + /// Hidden rows and columns, depending on the provider implementation, may be loaded in the UI Automation tree and will therefore be + /// reflected in the IGridProvider::RowCount and IGridProvider::ColumnCount properties. If the hidden rows and columns have not yet + /// been loaded they should not be counted. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igridprovider-getitem HRESULT GetItem( + // [in] int row, [in] int column, [out, retval] IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple GetItem(int row, int column); + + /// + /// Specifies the total number of rows in the grid. + /// This property is read-only. + /// + /// + /// + /// Hidden rows and columns, depending on the provider implementation, may be loaded in the logical tree and will therefore be + /// reflected in the IGridProvider::RowCount and IGridProvider::ColumnCount properties. If the hidden rows and columns have + /// not yet been loaded they will not be counted. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igridprovider-get_rowcount HRESULT + // get_RowCount( int *pRetVal ); + int RowCount { get; } + + /// + /// Specifies the total number of columns in the grid. + /// This property is read-only. + /// + /// + /// + /// Hidden rows and columns, depending on the provider implementation, may be loaded in the logical tree and will therefore be + /// reflected in the IGridProvider::RowCount and IGridProvider::ColumnCount properties. If the hidden rows and columns have + /// not yet been loaded they will not be counted. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-igridprovider-get_columncount HRESULT + // get_ColumnCount( int *pRetVal ); + int ColumnCount { get; } + } + + /// Provides access to controls that initiate or perform a single, unambiguous action and do not maintain state when activated. + /// + /// Implemented on a Microsoft UI Automation provider that must support the Invoke control pattern. + /// + /// Controls implement IInvokeProvider if the same behavior is not exposed through another control pattern provider. For example, + /// if the Invoke method of a control performs the same action as the IExpandCollapseProvider::Expand or Collapse method, the control + /// should not also implement IInvokeProvider. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iinvokeprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IInvokeProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("54fcb24b-e18e-47a2-b4d3-eccbe77599a2")] + public interface IInvokeProvider + { + /// Sends a request to activate a control and initiate its single, unambiguous action. + /// + /// IInvokeProvider::Invoke is an asynchronous call and must return immediately without blocking. + /// + /// Note   This is particularly critical for controls that, directly or indirectly, launch a modal dialog when invoked. Any + /// Microsoft UI Automation client that instigated the event will remain blocked until the modal dialog is closed. + /// + ///  + /// IInvokeProvider::Invoke raises the Invoked event after the control has completed its associated action, if possible. + /// The event should be raised before servicing the Invoke request in the following scenarios: + /// + /// + /// It is not possible or practical to wait until the action is complete. + /// + /// + /// The action requires user interaction. + /// + /// + /// The action is time-consuming and will cause the calling client to block for a significant length of time. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iinvokeprovider-invoke HRESULT Invoke(); + void Invoke(); + } + + /// Provides access to controls that act as containers of other controls, such as a virtual list-view. + /// + /// The ItemContainer control pattern allows a container object to efficiently lookup an item by a specified automation element property, + /// such as Name, AutomationId, or IsSelected state. While this control pattern is introduced with a view to being used by virtualized + /// containers, it can be implemented by any container that provides name lookup, independently of whether that container uses virtualization. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iitemcontainerprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IItemContainerProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e747770b-39ce-4382-ab30-d8fb3f336f24")] + public interface IItemContainerProvider + { + /// Retrieves an element within a containing element, based on a specified property value. + /// + /// Type: IRawElementProviderSimple* + /// The UI Automation provider of the element after which the search begins, or NULL to search all elements. + /// + /// + /// Type: PROPERTYID + /// The property identifier. For a list of property IDs, see Property Identifiers. + /// + /// + /// Type: VARIANT + /// The value of the property. + /// + /// + /// Type: IRawElementProviderSimple** + /// Receives a pointer to the UI Automation provider of the element. + /// + /// + /// + /// For virtual lists, the element returned may be a placeholder. IVirtualizedItemProvider::Realize can then be used to make the item + /// fully available. + /// + /// + /// The method returns E_INVALIDARG if searching by the specified property is not supported. Most containers should support + /// UIA_NamePropertyId and, if appropriate, UIA_AutomationIdPropertyId and UIA_SelectionItemIsSelectedPropertyId. + /// + /// + /// If propertyId is 0, all items are a match. This value can be used with pStartAfter equalling NULL to get the + /// first item, and then to get successive items. In this case, value should be VT_EMPTY. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iitemcontainerprovider-finditembyproperty + // HRESULT FindItemByProperty( [in] IRawElementProviderSimple *pStartAfter, [in] PROPERTYID propertyId, [in] VARIANT value, [out] + // IRawElementProviderSimple **pFound ); + IRawElementProviderSimple FindItemByProperty(IRawElementProviderSimple pStartAfter, UIAutomationClient.PROPERTYID propertyId, object value); + } + + /// + /// Enables Microsoft UI Automation clients to access the underlying IAccessible implementation of Microsoft Active Accessibility elements. + /// + /// + /// This interface is implemented by the Microsoft Active Accessibility to UI Automation Proxy to expose native MSAA properties and + /// methods to UI Automation clients that need them for legacy reasons. The proxy automatically supplies this interface for applications + /// or controls that implement Microsoft Active Accessibility natively. This interface is not intended to be implemented by UI Automation + /// applications or controls. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-ilegacyiaccessibleprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ILegacyIAccessibleProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e44c3566-915d-4070-99c6-047bff5a08f5")] + public interface ILegacyIAccessibleProvider + { + /// Selects the element. + /// + /// Type: long + /// + /// Specifies which selection or focus operations are to be performed. This parameter must have a combination of the values described + /// in SELFLAG Constants. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-select HRESULT + // Select( [in] long flagsSelect ); + void Select(SELFLAG flagsSelect); + + /// Performs the default action on the control. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-dodefaultaction + // HRESULT DoDefaultAction(); + void DoDefaultAction(); + + /// Sets the string value of the control. + /// + /// Type: LPCWSTR + /// A localized string that contains the value. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-setvalue + // HRESULT SetValue( [in] LPCWSTR szValue ); + void SetValue(string szValue); + + /// + /// Retrieves an accessible object that corresponds to a UI Automation element that supports the LegacyIAccessible control pattern. + /// + /// + /// Type: IAccessible** + /// Receives a pointer to the accessible object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-getiaccessible + // HRESULT GetIAccessible( [out] IAccessible **ppAccessible ); + IAccessible GetIAccessible(); + + /// Retrieves the selected item or items in the control. + /// + /// Type: SAFEARRAY** + /// Receives a pointer to a SAFEARRAY containing the selected items. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-getselection + // HRESULT GetSelection( [out] SAFEARRAY **pvarSelectedChildren ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetSelection(); + + /// + /// Specifies the child identifier of this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_childid + // HRESULT get_ChildId( int *pRetVal ); + int ChildId { get; } + + /// + /// Specifies the name of this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_name + // HRESULT get_Name( BSTR *pszName ); + string Name { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Specifies the value of this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_value + // HRESULT get_Value( BSTR *pszValue ); + string Value { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Contains the description of this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_description + // HRESULT get_Description( BSTR *pszDescription ); + string Description { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Specifies the role identifier of this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_role + // HRESULT get_Role( DWORD *pdwRole ); + uint Role { get; } + + /// + /// Specifies the state of this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_state + // HRESULT get_State( DWORD *pdwState ); + uint State { get; } + + /// + /// Specifies a string that contains help information for this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_help + // HRESULT get_Help( BSTR *pszHelp ); + string Help { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Specifies the keyboard shortcut for this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_keyboardshortcut + // HRESULT get_KeyboardShortcut( BSTR *pszKeyboardShortcut ); + string KeyboardShortcut { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Contains a description of the default action for this element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ilegacyiaccessibleprovider-get_defaultaction + // HRESULT get_DefaultAction( BSTR *pszDefaultAction ); + string DefaultAction { [return: MarshalAs(UnmanagedType.BStr)] get; } + } + + /// + /// Provides access to controls that provide, and are able to switch between, multiple representations of the same set of information or + /// child controls. + /// + /// Implemented on a Microsoft UI Automation provider that must support the MultipleView control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-imultipleviewprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IMultipleViewProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6278cab1-b556-4a1a-b4e0-418acc523201")] + public interface IMultipleViewProvider + { + /// Retrieves the name of a control-specific view. + /// + /// Type: int + /// A view identifier. + /// + /// + /// Type: BSTR* + /// Receives a localized name for the view. This parameter is passed uninitialized. + /// + /// + /// View identifiers can be retrieved by using IMultipleViewProvider::GetSupportedViews. + /// The collection of view identifiers must be identical for all instances of a control. + /// View names must be suitable for use in text-to-speech, Braille, and other accessible applications. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-imultipleviewprovider-getviewname HRESULT + // GetViewName( [in] int viewId, [out, retval] BSTR *pRetVal ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetViewName(int viewId); + + /// Sets the current control-specific view. + /// + /// Type: int + /// A view identifier. + /// + /// + /// View identifiers can be retrieved by using IMultipleViewProvider::GetSupportedViews. + /// The collection of view identifiers must be identical for all instances of a control. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-imultipleviewprovider-setcurrentview + // HRESULT SetCurrentView( [in] int viewId ); + void SetCurrentView(int viewId); + + /// Retrieves a collection of control-specific view identifiers. + /// + /// Type: SAFEARRAY** + /// + /// Receives a collection of control-specific integer values that identify the views available for a UI Automation element. This + /// parameter is passed uninitialized. + /// + /// + /// + /// An empty array is returned by UIAutoCore.dll if the provider does not supply any view identifiers. + /// The collection of view identifiers must be identical for all instances of a control. + /// View identifier values can be passed to IMultipleViewProvider::GetViewName. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-imultipleviewprovider-getsupportedviews + // HRESULT GetSupportedViews( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] + int[] GetSupportedViews(); + + /// + /// Identifies the current view that the control is using to display information or child controls. + /// This property is read-only. + /// + /// + /// The collection of view identifiers must be identical for all instances of a control. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-imultipleviewprovider-get_currentview + // HRESULT get_CurrentView( int *pRetVal ); + int CurrentView { get; } + } + + /// + /// Provides access to the underlying object model implemented by a control or application. Assistive technology applications can use the + /// object model to directly access the content of the control or application. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iobjectmodelprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IObjectModelProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("3ad86ebd-f5ef-483d-bb18-b1042a475d64")] + public interface IObjectModelProvider + { + /// Retrieves an interface used to access the underlying object model of the provider. + /// + /// Type: IUnknown** + /// Receives an interface for accessing the underlying object model. + /// + /// Client applications can use the object model to directly access the content of the control or application. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iobjectmodelprovider-getunderlyingobjectmodel + // HRESULT GetUnderlyingObjectModel( [out, retval] IUnknown **ppUnknown ); + [return: MarshalAs(UnmanagedType.IUnknown)] + object GetUnderlyingObjectModel(); + } + + /// + /// Exposes a method that is implemented by proxy providers to handle WinEvents. To implement Microsoft UI Automation event handling, a + /// proxy provider may need to handle WinEvents that are raised by the proxied UI. UI Automation will use the + /// IProxyProviderWinEventHandler interface to notify the provider that a WinEvent has been raised for the provider window. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iproxyproviderwineventhandler + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IProxyProviderWinEventHandler")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("89592ad4-f4e0-43d5-a3b6-bad7e111b435")] + public interface IProxyProviderWinEventHandler + { + /// Handles a WinEvent. + /// + /// Type: DWORD + /// The identifier of the incoming WinEvent. For a list of WinEvent IDs, see User32.EventConstants. + /// + /// + /// Type: HWND + /// The handle of the window for which the WinEvent was fired. This should also be the window for which the proxy was created. + /// + /// + /// Type: LONG + /// + /// The object identifier (OBJID_*) of the accessible object associated with the event. For a list of object identifiers, see Object Identifiers. + /// + /// + /// + /// Type: LONG + /// The child identifier of the element associated with the event, or CHILDID_SELF if the element is not a child. + /// + /// + /// Type: IProxyProviderWinEventSink* + /// + /// A pointer to the IProxyProviderWinEventSink interface provided by the UI Automation core. Any event that the proxy needs to raise + /// in response to the WinEvent being handled should be added to the sink. + /// + /// + /// + /// The provider should review the event data. If the provider needs to raise a UI Automation event in response, the data for that + /// event should be added to the pSink event sink. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iproxyproviderwineventhandler-respondtowinevent + // HRESULT RespondToWinEvent( [in] DWORD idWinEvent, [in] HWND hwnd, [in] LONG idObject, [in] LONG idChild, [in] + // IProxyProviderWinEventSink *pSink ); + void RespondToWinEvent(uint idWinEvent, HWND hwnd, int idObject, int idChild, IProxyProviderWinEventSink pSink); + } + + /// Exposes methods used by proxy providers to raise events. + /// + /// The IProxyProviderWinEventSink interface is provided by UIAutomationCore.dll when the framework calls the + /// IProxyProviderWinEventHandler::RespondToWinEvent method. The framework stores the events added to the + /// IProxyProviderWinEventSink object. When IProxyProviderWinEventHandler::RespondToWinEvent returns, the framework passes + /// the events back to the client side, where the UI Automation events are actually fired. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iproxyproviderwineventsink + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IProxyProviderWinEventSink")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4fd82b78-a43e-46ac-9803-0a6969c7c183")] + public interface IProxyProviderWinEventSink + { + /// Raises a property-changed event. + /// + /// Type: IRawElementProviderSimple* + /// A pointer to the provider for the element that will raise the event. + /// + /// + /// Type: PROPERTYID + /// The identifier of the property that is to be changed. For a list of property IDs, see Property Identifiers. + /// + /// + /// Type: VARIANT + /// The new value for the changed property. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iproxyproviderwineventsink-addautomationpropertychangedevent + // HRESULT AddAutomationPropertyChangedEvent( [in] IRawElementProviderSimple *pProvider, [in] PROPERTYID id, [in] VARIANT newValue ); + void AddAutomationPropertyChangedEvent(IRawElementProviderSimple pProvider, int id, [In] object newValue); + + /// Raises a Microsoft UI Automation event. + /// + /// Type: IRawElementProviderSimple* + /// A pointer to the provider for the element that will raise the event. + /// + /// + /// Type: EVENTID + /// The identifier of the event that will be raised. For a list of event identifiers, see Event Identifiers + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iproxyproviderwineventsink-addautomationevent + // HRESULT AddAutomationEvent( [in] IRawElementProviderSimple *pProvider, [in] EVENTID id ); + void AddAutomationEvent(IRawElementProviderSimple pProvider, int id); + + /// Raises an event to notify clients that the structure of the UI Automation tree has changed. + /// + /// Type: IRawElementProviderSimple* + /// A pointer to the provider of the element that is raising the event. + /// + /// + /// + /// Type: SAFEARRAY* + /// + /// A pointer to the runtime identifiers of the elements that are affected. These IDs enable applications to identify elements that + /// have been removed and are no longer represented by IUIAutomationElement interfaces. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iproxyproviderwineventsink-addstructurechangedevent + // HRESULT AddStructureChangedEvent( [in] IRawElementProviderSimple *pProvider, StructureChangeType structureChangeType, [in] + // SAFEARRAY *runtimeId ); + void AddStructureChangedEvent(IRawElementProviderSimple pProvider, StructureChangeType structureChangeType, [In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] int[] runtimeId); + } + + /// Provides access to controls that can be set to a value within a range. + /// Implemented on a Microsoft UI Automation provider that must support the RangeValue control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irangevalueprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRangeValueProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("36dc7aef-33e6-4691-afe1-2be7274b3d33")] + public interface IRangeValueProvider + { + /// Sets the value of the control. + /// + /// Type: double + /// The value to set. + /// + /// The actual value set depends on the control implementation. The control may round the requested value up or down. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-setvalue HRESULT + // SetValue( [in] double val ); + void SetValue(double val); + + /// + /// Specifies the value of the control. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-get_value HRESULT + // get_Value( double *pRetVal ); + double Value { get; } + + /// + /// Indicates whether the value of a control is read-only. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-get_isreadonly + // HRESULT get_IsReadOnly( BOOL *pRetVal ); + bool IsReadOnly { get; } + + /// + /// Specifies the maximum range value supported by the control. + /// This property is read-only. + /// + /// + /// This value should be greater than Minimum. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-get_maximum HRESULT + // get_Maximum( double *pRetVal ); + double Maximum { get; } + + /// + /// Specifies the minimum range value supported by the control. + /// This property is read-only. + /// + /// + /// This value should be less than Maximum. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-get_minimum HRESULT + // get_Minimum( double *pRetVal ); + double Minimum { get; } + + /// + /// + /// Specifies the value that is added to or subtracted from the IRangeValueProvider::Value property when a large change is made, such + /// as when the PAGE DOWN key is pressed. + /// + /// This property is read-only. + /// + /// + /// + /// + /// The LargeChange property can support Not a Number (NaN) value. When returning a NaN value, the provider should return a quiet + /// (non-signaling) NaN to avoid raising an exception if floating-point exceptions are turned on. The following example shows how to + /// create a quiet NaN: + /// + /// Alternatively, you can use the following function from the standard C++ libraries: + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-get_largechange + // HRESULT get_LargeChange( double *pRetVal ); + double LargeChange { get; } + + /// + /// + /// Specifies the value that is added to or subtracted from the IRangeValueProvider::Value property when a small change is made, such + /// as when an arrow key is pressed. + /// + /// This property is read-only. + /// + /// + /// + /// + /// The SmallChange property can support Not a Number (NaN) value. When returning a NaN value, the provider should return a quiet + /// (non-signaling) NaN to avoid raising an exception if floating-point exceptions are turned on. The following example shows how to + /// create a quiet NaN: + /// + /// Alternatively, you can use the following function from the standard C++ libraries: + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irangevalueprovider-get_smallchange + // HRESULT get_SmallChange( double *pRetVal ); + double SmallChange { get; } + } + + /// + /// Exposes methods that are called to notify the root element of a fragment when a Microsoft UI Automation client application begins or + /// ends listening for events on that fragment. + /// + /// + /// + /// Implementation of this interface is optional. It can be used to improve performance by raising events only when they are being + /// listened for. + /// + /// + /// Similar to implementing reference counting in Component Object Model (COM) programming, it is important for UI Automation providers + /// to treat the AdviseEventAdded and AdviseEventRemoved methods like the AddRef and Release methods of the IUnknown interface. As long + /// as AdviseEventAdded has been called more times than AdviseEventRemoved for a specific event or property, the provider + /// should continue to raise corresponding events, because some clients are still listening. Alternatively, UI Automation providers can + /// use the UiaClientsAreListening function to determine if at least one client is listening and, if so, raise all appropriate events. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementprovideradviseevents + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderAdviseEvents")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("a407b27b-0f6d-4427-9292-473c7bf93258")] + public interface IRawElementProviderAdviseEvents + { + /// + /// Notifies the Microsoft UI Automation provider when a UI Automation client begins listening for a specific event, including a + /// property-changed event. + /// + /// + /// Type: EVENTID + /// The identifier of the event being added. For a list of event IDs, see Event Identifiers. + /// + /// + /// Type: SAFEARRAY* + /// + /// A pointer to the identifiers of properties being added, or NULL if the event listener being added is not listening for + /// property events. + /// + /// + /// + /// This method enables the provider to reduce overhead by raising only events that are being listened for. + /// + /// It is important for UI Automation providers to treat the IRawElementProviderAdviseEvents::AdviseEventAdded like the AddRef + /// method of the IUnknown interface. As long as AdviseEventAdded has been called more times than AdviseEventRemoved for a + /// specific event or property, the provider should continue to raise corresponding events, because some clients are still listening. + /// Alternatively, UI Automation providers can use the UiaClientsAreListening function to determine if at least one client is + /// listening and, if so, raise all appropriate events. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovideradviseevents-adviseeventadded + // HRESULT AdviseEventAdded( [in] EVENTID eventId, [in] SAFEARRAY *propertyIDs ); + void AdviseEventAdded(int eventId, [In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] int[] propertyIDs); + + /// + /// Notifies the Microsoft UI Automation provider when a UI Automation client stops listening for a specific event, including a + /// property-changed event. + /// + /// + /// Type: EVENTID + /// The identifier of the event being removed. For a list of event IDs, see Event Identifiers. + /// + /// + /// Type: SAFEARRAY* + /// + /// A pointer to the identifiers of the properties being removed, or NULL if the event listener being removed is not listening + /// for property events. + /// + /// + /// + /// This method enables the provider to reduce overhead by raising only events that are being listened for. + /// + /// It is important for UI Automation providers to treat the IRawElementProviderAdviseEvents::AdviseEventRemoved like the + /// Release method of the IUnknown interface. As long as AdviseEventAdded has been called more times than AdviseEventRemoved + /// for a specific event or property, the provider should continue to raise corresponding events, because some clients are still + /// listening. Alternatively, UI Automation providers can use the UiaClientsAreListening function to determine if at least one client + /// is listening and, if so, raise all appropriate events. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovideradviseevents-adviseeventremoved + // HRESULT AdviseEventRemoved( [in] EVENTID eventId, [in] SAFEARRAY *propertyIDs ); + void AdviseEventRemoved(int eventId, [In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] int[] propertyIDs); + } + + /// + /// Exposes methods and properties on UI elements that are part of a structure more than one level deep, such as a list box or list item. + /// Implemented by Microsoft UI Automation provider. + /// + /// The root node of the fragment must also support the IRawElementProviderFragmentRoot interface. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementproviderfragment + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderFragment")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f7063da8-8359-439c-9297-bbc5299a7d87")] + public interface IRawElementProviderFragment + { + /// Retrieves the Microsoft UI Automation element in a specified direction within the UI Automation tree. + /// + /// + /// Type: IRawElementProviderFragment** + /// + /// Receives a pointer to the provider of the UI Automation element in the specified direction, or NULL if there is no element + /// in that direction. This parameter is passed uninitialized. + /// + /// + /// + /// The UI Automation server's implementations of this method define the structure of the UI Automation tree. + /// + /// Navigation must be supported upward to the parent, downward to the first and last child, and laterally to the next and previous + /// siblings, as applicable. + /// + /// + /// Each child node has only one parent and must be placed in the chain of siblings reached from the parent by + /// NavigateDirection_FirstChild and NavigateDirection_LastChild. + /// + /// + /// Relationships among siblings must be identical in both directions: if A is B's previous sibling ( + /// NavigateDirection_PreviousSibling), then B is A's next sibling ( NavigateDirection_NextSibling). A first child ( + /// NavigateDirection_FirstChild) has no previous sibling, and a last child ( NavigateDirection_LastChild) has no next sibling. + /// + /// + /// Fragment roots do not enable navigation to a parent or siblings; navigation among fragment roots is handled by the default window + /// providers. Elements in fragments must navigate only to other elements within that fragment. + /// + /// Examples + /// + /// The following example shows an implementation for a list item provider. The member variables for the parent, previous sibling, + /// and next sibling providers were initialized when the list was created. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragment-navigate + // HRESULT Navigate( NavigateDirection direction, [out, retval] IRawElementProviderFragment **pRetVal ); + [return: MarshalAs(UnmanagedType.Interface)] + IRawElementProviderFragment Navigate(NavigateDirection direction); + + /// Retrieves the runtime identifier of an element. + /// + /// Type: SAFEARRAY** + /// Receives a pointer to the runtime identifier. This parameter is passed uninitialized. + /// + /// + /// + /// Implementations should return NULL for a top-level element that is hosted in a window. Other elements should return an + /// array that contains UiaAppendRuntimeId (defined in Uiautomationcoreapi.h), followed by a value that is unique within an + /// instance of the fragment. + /// + /// Examples + /// + /// The following implementation for a list item returns a runtime identifier made up of the UiaAppendRuntimeId constant and + /// the index of the item within the list. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragment-getruntimeid + // HRESULT GetRuntimeId( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] + int[] GetRuntimeId(); + + /// + /// Specifies the bounding rectangle of this element. + /// This property is read-only. + /// + /// + /// + /// The bounding rectangle is defined by the location of the top left corner on the screen, and the dimensions. + /// + /// No clipping is required if the element is partly obscured or partly off-screen. The IsOffscreen property should be set to + /// indicate whether the rectangle is actually visible. + /// + /// Not all points within the bounding rectangle are necessarily clickable. + /// Examples + /// + /// The following example implementation by a list item provider calculates the bounding rectangle for the item based on its height + /// and position within the containing list box. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragment-get_boundingrectangle + // HRESULT get_BoundingRectangle( UiaRect *pRetVal ); + UiaRect get_BoundingRectangle(); + + /// + /// Retrieves an array of root fragments that are embedded in the Microsoft UI Automation tree rooted at the current element. + /// + /// + /// Type: SAFEARRAY** + /// Receives an array of pointers to the root fragments, or NULL (see Remarks). This parameter is passed uninitialized. + /// + /// + /// This method returns an array of fragments only if the current element is hosting another automation framework. Most providers + /// return NULL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragment-getembeddedfragmentroots + // HRESULT GetEmbeddedFragmentRoots( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderFragmentRoot[] GetEmbeddedFragmentRoots(); + + /// Sets the focus to this element. + /// + /// The Microsoft UI Automation framework will ensure that the part of the interface that hosts this fragment is already focused + /// before calling this method. Your implementation should update only its internal focus state; for example, by repainting a list + /// item to show that it has the focus. If you prefer that UI Automation not focus the parent window, set + /// ProviderOptions_ProviderOwnsSetFocus in IRawElementProviderSimple::ProviderOptions for the fragment root. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragment-setfocus + // HRESULT SetFocus(); + void SetFocus(); + + /// + /// Specifies the root node of the fragment. + /// This property is read-only. + /// + /// + /// + /// A provider for a fragment root should return a pointer to its own implementation of IRawElementProviderFragmentRoot. + /// Examples + /// The following example implementation for a list item provider returns the provider for the parent list box. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragment-get_fragmentroot + // HRESULT get_FragmentRoot( IRawElementProviderFragmentRoot **pRetVal ); + IRawElementProviderFragmentRoot FragmentRoot { get; } + } + + /// Exposes methods and properties on the root element in a fragment. + /// + /// This interface is implemented by a root element within a framework; for example, a list box within a window. Other elements in the + /// same fragment, such as list items, implement the IRawElementProviderFragment interface. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementproviderfragmentroot + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderFragmentRoot")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("620ce2a5-ab8f-40a9-86cb-de3c75599b58")] + public interface IRawElementProviderFragmentRoot + { + /// Retrieves the provider of the element that is at the specified point in this fragment. + /// + /// Type: double + /// The horizontal screen coordinate. + /// + /// + /// Type: double + /// The vertical screen coordinate. + /// + /// + /// Type: IRawElementProviderFragment** + /// Receives a pointer to the provider of the element at (x, y), or NULL if none exists. This parameter is passed uninitialized. + /// + /// + /// The returned provider should correspond to the element that would receive mouse input at the specified point. + /// + /// If the point is on this element but not on any child element, either NULL or the provider of the fragment root is + /// returned. If the point is on an element in another framework that is hosted by this fragment, the method returns the element that + /// hosts that fragment (as indicated by IRawElementProviderFragment::GetEmbeddedFragmentRoots). + /// + /// Examples + /// + /// The following example shows an implementation for a list box hosted in an HWND whose handle is m_controlHwnd. + /// IndexFromY retrieves the index of the list item at the cursor position, and GetItemByIndex retrieves the UI Automation provider + /// for that item. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragmentroot-elementproviderfrompoint + // HRESULT ElementProviderFromPoint( [in] double x, [in] double y, [out, retval] IRawElementProviderFragment **pRetVal ); + IRawElementProviderFragment ElementProviderFromPoint(double x, double y); + + /// Retrieves the element in this fragment that has the input focus. + /// + /// Type: IRawElementProviderFragment** + /// + /// Receives a pointer to the IRawElementProviderFragment interface of the element in this fragment that has the input focus, if any; + /// otherwise NULL. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderfragmentroot-getfocus + // HRESULT GetFocus( [out, retval] IRawElementProviderFragment **pRetVal ); + IRawElementProviderFragment GetFocus(); + } + + /// + /// This interface is implemented by a Microsoft UI Automation provider when the provider is the root of an accessibility tree that + /// includes windowless controls that support Microsoft Active Accessibility. Because UI Automation and Microsoft Active Accessibility + /// use different interfaces, this interface enables a client to discover the list of hosted Microsoft Active Accessibility controls in + /// case it needs to treat them differently. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementproviderhostingaccessibles + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderHostingAccessibles")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("24be0b07-d37d-487a-98cf-a13ed465e9b3")] + public interface IRawElementProviderHostingAccessibles + { + /// + /// Retrieves the IAccessible interface pointers of the windowless Microsoft ActiveX controls that are hosted by this provider. + /// + /// + /// Type: SAFEARRAY** + /// Receives the IAccessible pointers of the hosted windowless ActiveX controls. + /// + /// + /// + /// An ActiveX control container with an existing IRawElementProviderFragmentRoot interface implements this method on the same object + /// that implements IRawElementProviderFragmentRoot. When called, this method should query each contained windowless control + /// for an IAccessible pointer and then add the pointer to the safe array. + /// + /// This method should ignore providers that do not implement IAccessible. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderhostingaccessibles-getembeddedaccessibles + // HRESULT GetEmbeddedAccessibles( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IAccessible[] GetEmbeddedAccessibles(); + } + + /// Exposes a method that enables repositioning of window-based elements within the fragment's UI Automation tree. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementproviderhwndoverride + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderHwndOverride")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1d5df27c-8947-4425-b8d9-79787bb460b8")] + public interface IRawElementProviderHwndOverride + { + /// Gets a UI Automation provider for the specified element. + /// + /// Type: HWND + /// The window handle of the element. + /// + /// + /// Type: IRawElementProviderSimple** + /// + /// Receives a pointer to the new provider for the specified window, or NULL if the provider is not being overridden. This + /// parameter is passed uninitialized. + /// + /// + /// + /// + /// This method is implemented by fragment roots that contain window-based child elements. By default, controls hosted in windows are + /// served by default providers in addition to any custom providers. The default providers treat all windows within a parent window + /// as siblings. If you want to restructure the UI Automation tree so that one window-based control is seen as a child of another, + /// you must override the default provider by implementing this method on the fragment root. The returned provider can supply + /// additional properties or override properties of the specified component. + /// + /// + /// The returned provider must be part of the fragment tree. It can supply additional properties or override properties of the + /// specified component. + /// + /// + /// If the returned provider implements IRawElementProviderFragment, the provider should be part of the fragment's tree and be + /// reachable by navigating from the fragment's root. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderhwndoverride-getoverrideproviderforhwnd + // HRESULT GetOverrideProviderForHwnd( [in] HWND hwnd, [out, retval] IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple GetOverrideProviderForHwnd(HWND hwnd); + } + + /// Defines methods and properties that expose simple UI elements. + /// + /// This interface can be implemented on: + /// + /// + /// UI Automation provider for simple UI elements, such as buttons. + /// + /// + /// Providers that add or override properties or control patterns on a UI element that already has a provider. + /// + /// + /// Providers for complex elements must also implement IRawElementProviderFragment and, if they are root elements, IRawElementProviderFragmentRoot. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementprovidersimple + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderSimple")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("d6dd68d1-86fd-4332-8666-9abedea2d24c")] + public interface IRawElementProviderSimple + { + /// Retrieves a pointer to an object that provides support for a control pattern on a Microsoft UI Automation element. + /// + /// Type: PATTERNID + /// The identifier of the control pattern. For a list of control pattern IDs, see Control Pattern Identifiers. + /// + /// + /// Type: IUnknown** + /// + /// Receives a pointer to the object that supports the control pattern, or NULL if the control pattern is not supported. This + /// parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-getpatternprovider + // HRESULT GetPatternProvider( [in] PATTERNID patternId, [out, retval] IUnknown **pRetVal ); + [return: MarshalAs(UnmanagedType.IUnknown)] + object? GetPatternProvider(UIAutomationClient.PATTERNID patternId); + + /// Retrieves the value of a property supported by the Microsoft UI Automation provider. + /// + /// Type: PROPERTYID + /// The property identifier. For a list of property IDs, see Property Identifiers. + /// + /// + /// Type: VARIANT* + /// + /// Receives the property value, or VT_EMPTY if the property is not supported by this provider. This parameter is passed + /// uninitialized. See Remarks. + /// + /// + /// + /// + /// If a provider is explicitly hiding the property value (that is, the provider does not supply the property, and the request is not + /// to be passed through to other providers), it should return a pointer obtained by using the UiaGetReservedNotSupportedValue + /// function. For example: + /// + /// + /// UI Automation properties of the double type support Not a Number (NaN) values. When returning a NaN value, the provider + /// should return a quiet (non-signaling) NaN to avoid raising an exception if floating-point exceptions are turned on. The following + /// example shows how to create a quiet NaN: + /// + /// Alternatively, you can use the following function from the standard C++ libraries: + /// Examples + /// + /// The following example returns various property values. The UiaIds structure contains property identifiers; to see how it + /// is initialized, see UiaLookupId. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-getpropertyvalue + // HRESULT GetPropertyValue( [in] PROPERTYID propertyId, [out, retval] VARIANT *pRetVal ); + object GetPropertyValue(UIAutomationClient.PROPERTYID propertyId); + + /// + /// + /// Specifies the type of Microsoft UI Automation provider; for example, whether it is a client-side (proxy) or server-side provider. + /// + /// This property is read-only. + /// + /// + /// + /// The method must return either ProviderOptions_ServerSideProvider or ProviderOptions_ClientSideProvider. + /// + /// UI Automation handles the various types of providers differently. For example, events from a server-side provider are broadcast + /// to all listening clients, but events from client-side (proxy) providers remain in the client. + /// + /// Examples + /// The following example implements this method for a server-side UI Automation provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-get_provideroptions + // HRESULT get_ProviderOptions( ProviderOptions *pRetVal ); + ProviderOptions ProviderOptions { get; } + + /// + /// Specifies the host provider for this element. + /// This property is read-only. + /// + /// + /// + /// + /// This property is generally the Microsoft UI Automation provider for the window of a custom control. UI Automation uses this + /// provider in combination with the custom provider. For example, the runtime identifier of the element is usually obtained from the + /// host provider. + /// + /// + /// A host provider must be returned in the following cases: when the element is a fragment root, when the element is a simple + /// element (such as a push button), and when the provider is a repositioning placeholder (for more information, see Provider + /// Repositioning). In other cases, the property should be NULL. + /// + /// Examples + /// The following example returns the host provider for the window that hosts the control served by this provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-get_hostrawelementprovider + // HRESULT get_HostRawElementProvider( IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple HostRawElementProvider { get; } + } + + /// Extends the IRawElementProviderSimple interface to enable programmatically invoking context menus. + /// + /// This interface can be implemented on: + /// + /// + /// Providers that add or override properties or control patterns on a UI element that already has a provider. + /// + /// + /// + /// If no context menu is available directly on the element on which ShowContextMenu was invoked, the provider should attempt to invoke a + /// context menu on the UI Automation parent of the current item. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementprovidersimple2 + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderSimple2")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("a0a839a9-8da1-4a82-806a-8e0d44e79f56")] + public interface IRawElementProviderSimple2 : IRawElementProviderSimple + { + /// Retrieves a pointer to an object that provides support for a control pattern on a Microsoft UI Automation element. + /// + /// Type: PATTERNID + /// The identifier of the control pattern. For a list of control pattern IDs, see Control Pattern Identifiers. + /// + /// + /// Type: IUnknown** + /// + /// Receives a pointer to the object that supports the control pattern, or NULL if the control pattern is not supported. This + /// parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-getpatternprovider + // HRESULT GetPatternProvider( [in] PATTERNID patternId, [out, retval] IUnknown **pRetVal ); + [return: MarshalAs(UnmanagedType.IUnknown)] + new object GetPatternProvider(UIAutomationClient.PATTERNID patternId); + + /// Retrieves the value of a property supported by the Microsoft UI Automation provider. + /// + /// Type: PROPERTYID + /// The property identifier. For a list of property IDs, see Property Identifiers. + /// + /// + /// Type: VARIANT* + /// + /// Receives the property value, or VT_EMPTY if the property is not supported by this provider. This parameter is passed + /// uninitialized. See Remarks. + /// + /// + /// + /// + /// If a provider is explicitly hiding the property value (that is, the provider does not supply the property, and the request is not + /// to be passed through to other providers), it should return a pointer obtained by using the UiaGetReservedNotSupportedValue + /// function. For example: + /// + /// + /// UI Automation properties of the double type support Not a Number (NaN) values. When returning a NaN value, the provider + /// should return a quiet (non-signaling) NaN to avoid raising an exception if floating-point exceptions are turned on. The following + /// example shows how to create a quiet NaN: + /// + /// Alternatively, you can use the following function from the standard C++ libraries: + /// Examples + /// + /// The following example returns various property values. The UiaIds structure contains property identifiers; to see how it + /// is initialized, see UiaLookupId. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-getpropertyvalue + // HRESULT GetPropertyValue( [in] PROPERTYID propertyId, [out, retval] VARIANT *pRetVal ); + new object GetPropertyValue(UIAutomationClient.PROPERTYID propertyId); + + /// + /// + /// Specifies the type of Microsoft UI Automation provider; for example, whether it is a client-side (proxy) or server-side provider. + /// + /// This property is read-only. + /// + /// + /// + /// The method must return either ProviderOptions_ServerSideProvider or ProviderOptions_ClientSideProvider. + /// + /// UI Automation handles the various types of providers differently. For example, events from a server-side provider are broadcast + /// to all listening clients, but events from client-side (proxy) providers remain in the client. + /// + /// Examples + /// The following example implements this method for a server-side UI Automation provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-get_provideroptions + // HRESULT get_ProviderOptions( ProviderOptions *pRetVal ); + new ProviderOptions ProviderOptions { get; } + + /// + /// Specifies the host provider for this element. + /// This property is read-only. + /// + /// + /// + /// + /// This property is generally the Microsoft UI Automation provider for the window of a custom control. UI Automation uses this + /// provider in combination with the custom provider. For example, the runtime identifier of the element is usually obtained from the + /// host provider. + /// + /// + /// A host provider must be returned in the following cases: when the element is a fragment root, when the element is a simple + /// element (such as a push button), and when the provider is a repositioning placeholder (for more information, see Provider + /// Repositioning). In other cases, the property should be NULL. + /// + /// Examples + /// The following example returns the host provider for the window that hosts the control served by this provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-get_hostrawelementprovider + // HRESULT get_HostRawElementProvider( IRawElementProviderSimple **pRetVal ); + new IRawElementProviderSimple HostRawElementProvider { get; } + + /// Programmatically invokes a context menu on the target element. + /// + /// This method returns an error code if the context menu could not be invoked. + /// + /// If no context menu is available directly on the element on which ShowContextMenu was invoked, the provider should attempt + /// to invoke a context menu on the UI Automation parent of the current item. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple2-showcontextmenu + // HRESULT ShowContextMenu(); + void ShowContextMenu(); + } + + /// + /// Extends the IRawElementProviderSimple2 interface to enable retrieving metadata about how accessible technology should say the + /// preferred content type. + /// + /// + /// + /// Screen reading accessibility tools like Narrator use a speech synthesizer to read what an app is showing. Speech synthesizers usually + /// read the provided content well based on the content description. + /// + /// + /// However, the speech synthesizer could use some help describing the preferred content type. The SayAs command provides accurate + /// content reading from a Microsoft UI Automation provider to a UI Automation client (such as a screen reader) through UI Automation + /// core APIs. + /// + /// Examples: + /// + /// + /// + /// Given the date 10/4, is the format Month/Day or Day/Month? If a screen reader does not know, you could hear October 4th or 10th April. + /// + /// + /// + /// Given the string "10-100", is this "Ten to one hundred" or "Ten minus 100"? + /// The ability to mark the "10" as a number and the "-100" as a number helps active technology (AT) read it better. + /// + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementprovidersimple3 + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderSimple3")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("fcf5d820-d7ec-4613-bdf6-42a84ce7daaf")] + public interface IRawElementProviderSimple3 : IRawElementProviderSimple2 + { + /// Retrieves a pointer to an object that provides support for a control pattern on a Microsoft UI Automation element. + /// + /// Type: PATTERNID + /// The identifier of the control pattern. For a list of control pattern IDs, see Control Pattern Identifiers. + /// + /// + /// Type: IUnknown** + /// + /// Receives a pointer to the object that supports the control pattern, or NULL if the control pattern is not supported. This + /// parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-getpatternprovider + // HRESULT GetPatternProvider( [in] PATTERNID patternId, [out, retval] IUnknown **pRetVal ); + [return: MarshalAs(UnmanagedType.IUnknown)] + new object GetPatternProvider(UIAutomationClient.PATTERNID patternId); + + /// Retrieves the value of a property supported by the Microsoft UI Automation provider. + /// + /// Type: PROPERTYID + /// The property identifier. For a list of property IDs, see Property Identifiers. + /// + /// + /// Type: VARIANT* + /// + /// Receives the property value, or VT_EMPTY if the property is not supported by this provider. This parameter is passed + /// uninitialized. See Remarks. + /// + /// + /// + /// + /// If a provider is explicitly hiding the property value (that is, the provider does not supply the property, and the request is not + /// to be passed through to other providers), it should return a pointer obtained by using the UiaGetReservedNotSupportedValue + /// function. For example: + /// + /// + /// UI Automation properties of the double type support Not a Number (NaN) values. When returning a NaN value, the provider + /// should return a quiet (non-signaling) NaN to avoid raising an exception if floating-point exceptions are turned on. The following + /// example shows how to create a quiet NaN: + /// + /// Alternatively, you can use the following function from the standard C++ libraries: + /// Examples + /// + /// The following example returns various property values. The UiaIds structure contains property identifiers; to see how it + /// is initialized, see UiaLookupId. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-getpropertyvalue + // HRESULT GetPropertyValue( [in] PROPERTYID propertyId, [out, retval] VARIANT *pRetVal ); + new object GetPropertyValue(UIAutomationClient.PROPERTYID propertyId); + + /// + /// + /// Specifies the type of Microsoft UI Automation provider; for example, whether it is a client-side (proxy) or server-side provider. + /// + /// This property is read-only. + /// + /// + /// + /// The method must return either ProviderOptions_ServerSideProvider or ProviderOptions_ClientSideProvider. + /// + /// UI Automation handles the various types of providers differently. For example, events from a server-side provider are broadcast + /// to all listening clients, but events from client-side (proxy) providers remain in the client. + /// + /// Examples + /// The following example implements this method for a server-side UI Automation provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-get_provideroptions + // HRESULT get_ProviderOptions( ProviderOptions *pRetVal ); + new ProviderOptions ProviderOptions { get; } + + /// + /// Specifies the host provider for this element. + /// This property is read-only. + /// + /// + /// + /// + /// This property is generally the Microsoft UI Automation provider for the window of a custom control. UI Automation uses this + /// provider in combination with the custom provider. For example, the runtime identifier of the element is usually obtained from the + /// host provider. + /// + /// + /// A host provider must be returned in the following cases: when the element is a fragment root, when the element is a simple + /// element (such as a push button), and when the provider is a repositioning placeholder (for more information, see Provider + /// Repositioning). In other cases, the property should be NULL. + /// + /// Examples + /// The following example returns the host provider for the window that hosts the control served by this provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple-get_hostrawelementprovider + // HRESULT get_HostRawElementProvider( IRawElementProviderSimple **pRetVal ); + new IRawElementProviderSimple HostRawElementProvider { get; } + + /// Programmatically invokes a context menu on the target element. + /// + /// This method returns an error code if the context menu could not be invoked. + /// + /// If no context menu is available directly on the element on which ShowContextMenu was invoked, the provider should attempt + /// to invoke a context menu on the UI Automation parent of the current item. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple2-showcontextmenu + // HRESULT ShowContextMenu(); + new void ShowContextMenu(); + + /// + /// Gets metadata from the UI Automation element that indicates how the information should be interpreted. For example, should the + /// string "1/4" be interpreted as a fraction or a date? + /// + /// The ID of the property to retrieve. + /// Specifies the type of metadata to retrieve. + /// The metadata. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementprovidersimple3-getmetadatavalue + // HRESULT GetMetadataValue( [in] int targetId, [in] METADATAID metadataId, [out, retval] VARIANT *returnVal ); + object GetMetadataValue(int targetId, UIAutomationClient.METADATAID metadataId); + } + + /// + /// A Microsoft ActiveX control site implements this interface to enable a Microsoft UI Automation-enabled ActiveX control to express its + /// accessibility. This interface enables the control container to provide an IRawElementProviderFragment pointer for the parent or + /// siblings of the windowless ActiveX control, and to provide a runtime ID that is unique to the control site. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-irawelementproviderwindowlesssite + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IRawElementProviderWindowlessSite")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0a2a93cc-bfad-42ac-9b2e-0991fb0d3ea0")] + public interface IRawElementProviderWindowlessSite + { + /// + /// Retrieves a fragment pointer for a fragment that is adjacent to the windowless Microsoft ActiveX control owned by this control site. + /// + /// + /// + /// Type: IRawElementProviderFragment** + /// Receives the adjacent fragment. + /// + /// + /// + /// To return the parent of the fragment, an object that implements the IRawElementProviderFragment interface must be able to + /// implement the Navigate method. Implementing Navigate is difficult for a windowless ActiveX control because the control + /// might be unable to determine its location in the accessible tree of the parent object. The GetAdjacentFragment method + /// enables the windowless ActiveX control to query its site for the adjacent fragment, and then return that fragment to the client + /// that called Navigate. + /// + /// A provider typically calls this method as part of handling the IRawElementProviderFragment::Navigate method. + /// Examples + /// The following C++ code example shows how to implement the GetAdjacentFragment method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderwindowlesssite-getadjacentfragment + // HRESULT GetAdjacentFragment( NavigateDirection direction, [out, retval] IRawElementProviderFragment **ppParent ); + IRawElementProviderFragment GetAdjacentFragment(NavigateDirection direction); + + /// Retrieves a Microsoft UI Automation runtime ID that is unique to the windowless Microsoft ActiveX control site. + /// + /// Type: SAFEARRAY** + /// Receives the runtime ID. + /// + /// + /// + /// A UI Automation fragment must implement the IRawElementProviderFragment::GetRuntimeId method to return a unique ID for the + /// fragment. This is difficult for a windowless ActiveX control, which must be able to identify itself as unique among other + /// windowless controls in the ActiveX control container. To resolve this issue, the windowless site should implement the + /// GetRuntimeIdPrefix method by forming a SAFEARRAY that contains the constant UiaAppendRuntimeId, followed by an + /// integer value that is unique to this windowless site. + /// + /// + /// The fragment can then append an integer value that is unique relative to all other fragments in the windowless ActiveX control, + /// and return it to the client. + /// + /// + /// For example, the site might return a SAFEARRAY with the following contents: . This might represent the third ActiveX control in + /// the container. The fragment provider's GetRuntimeId method could then form a SAFEARRAY with the following contents: . This might + /// represent the fifth fragment within the ActiveX container. The whole SAFEARRAY would be a unique ID relative to the whole ActiveX + /// control container. + /// + /// A provider typically calls this method as part of handling the GetRuntimeId method. + /// Examples + /// The following C++ code example shows how to implement the GetRuntimeIdPrefix method. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-irawelementproviderwindowlesssite-getruntimeidprefix + // HRESULT GetRuntimeIdPrefix( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] + int[] GetRuntimeIdPrefix(); + } + + /// Provides access to individual child controls of containers that implement IScrollProvider. + /// Implemented on a Microsoft UI Automation provider that must support the ScrollItem control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iscrollitemprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IScrollItemProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2360c714-4bf1-4b26-ba65-9b21316127eb")] + public interface IScrollItemProvider + { + /// + /// Scrolls the content area of a container object in order to display the control within the visible region (viewport) of the container. + /// + /// This method will not guarantee the position of the control within the visible region (viewport) of the container. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollitemprovider-scrollintoview + // HRESULT ScrollIntoView(); + void ScrollIntoView(); + } + + /// + /// Provides access to controls that act as scrollable containers for a collection of child objects. The children of this control must + /// implement IScrollItemProvider. + /// + /// Implemented on a Microsoft UI Automation provider that must support the Scroll control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iscrollprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IScrollProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b38b8077-1fc3-42a5-8cae-d40c2215055a")] + public interface IScrollProvider + { + /// Scrolls the visible region of the content area horizontally and vertically. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-scroll HRESULT Scroll( + // ScrollAmount horizontalAmount, ScrollAmount verticalAmount ); + void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount); + + /// Sets the horizontal and vertical scroll position as a percentage of the total content area within the control. + /// + /// Type: double + /// + /// The horizontal position as a percentage of the content area's total range, or UIA_ScrollPatternNoScroll if there is no + /// horizontal scrolling. + /// + /// + /// + /// Type: double + /// + /// The vertical position as a percentage of the content area's total range, or UIA_ScrollPatternNoScroll if there is no + /// vertical scrolling. + /// + /// + /// This method is only useful when the content area of the control is larger than the visible region. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-setscrollpercent HRESULT + // SetScrollPercent( [in] double horizontalPercent, [in] double verticalPercent ); + void SetScrollPercent(double horizontalPercent, double verticalPercent); + + /// + /// Specifies the horizontal scroll position. + /// This property is read-only. + /// + /// + /// + /// The horizontal scroll position can be reported as UIA_ScrollPatternNoScroll if no valid position is available; for + /// example, if the window does not have a horizontal scroll bar. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-get_horizontalscrollpercent + // HRESULT get_HorizontalScrollPercent( double *pRetVal ); + double HorizontalScrollPercent { get; } + + /// + /// Specifies the vertical scroll position. + /// This property is read-only. + /// + /// + /// + /// The vertical scroll position can be reported as UIA_ScrollPatternNoScroll if no valid position is available; for example, + /// if the window does not have a vertical scroll bar. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-get_verticalscrollpercent + // HRESULT get_VerticalScrollPercent( double *pRetVal ); + double VerticalScrollPercent { get; } + + /// + /// Specifies the horizontal size of the viewable region. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-get_horizontalviewsize + // HRESULT get_HorizontalViewSize( double *pRetVal ); + double HorizontalViewSize { get; } + + /// + /// Specifies the vertical size of the viewable region. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-get_verticalviewsize + // HRESULT get_VerticalViewSize( double *pRetVal ); + double VerticalViewSize { get; } + + /// + /// Indicates whether the control can scroll horizontally. + /// This property is read-only. + /// + /// + /// + /// This property can be dynamic. For example, the content area of the control might not be larger than the current viewable area, + /// meaning IScrollProvider::HorizontallyScrollable is FALSE. However, either resizing the control or adding child + /// items may increase the bounds of the content area beyond the viewable area, meaning + /// IScrollProvider::HorizontallyScrollable is TRUE. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-get_horizontallyscrollable + // HRESULT get_HorizontallyScrollable( BOOL *pRetVal ); + bool HorizontallyScrollable { get; } + + /// + /// Indicates whether the control can scroll vertically. + /// This property is read-only. + /// + /// + /// + /// This property can be dynamic. For example, the content area of the control might not be larger than the viewable area, meaning + /// IScrollProvider::VerticallyScrollable is FALSE. However, resizing the control or adding child items may increase + /// the bounds of the content area beyond the viewable area, meaning that IScrollProvider::VerticallyScrollable is TRUE. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iscrollprovider-get_verticallyscrollable + // HRESULT get_VerticallyScrollable( BOOL *pRetVal ); + bool VerticallyScrollable { get; } + } + + /// Provides access to individual, selectable child controls of containers that implement ISelectionProvider. + /// Implemented on a Microsoft UI Automation provider that must support the SelectionItem control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionitemprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ISelectionItemProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2acad808-b2d4-452d-a407-91ff1ad167b2")] + public interface ISelectionItemProvider + { + /// Deselects any selected items and then selects the current element. + /// + /// If the current element isn’t selected, this method deselects any selected items and then selects the current element. If the + /// current element is already selected, this method does nothing. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-select HRESULT Select(); + void Select(); + + /// Adds the current element to the collection of selected items. + /// + /// + /// If the result of a call to ISelectionItemProvider::AddToSelection is that a single item is selected, then send an + /// UIA_SelectionItem_ElementSelectedEventId event for that element; otherwise send an + /// UIA_SelectionItem_ElementAddedToSelectionEventId or UIA_SelectionItem_ElementRemovedFromSelectionEventId event as appropriate. + /// + /// + /// Note   This rule does not depend on whether the container allows single or multiple selection, or on what method was + /// used to change the selection. Only the result matters. + /// + ///  + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-addtoselection + // HRESULT AddToSelection(); + void AddToSelection(); + + /// Removes the current element from the collection of selected items. + /// + /// Send an UIA_SelectionItem_ElementRemovedFromSelectionEventId event as appropriate. + /// + /// Note   This rule does not depend on whether the container allows single or multiple selection, or on what method was + /// used to change the selection. Only the result matters. + /// + ///  + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-removefromselection + // HRESULT RemoveFromSelection(); + void RemoveFromSelection(); + + /// + /// Indicates whether an item is selected. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-get_isselected + // HRESULT get_IsSelected( BOOL *pRetVal ); + bool IsSelected { get; } + + /// + /// Specifies the provider that implements ISelectionProvider and acts as the container for the calling object. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionitemprovider-get_selectioncontainer + // HRESULT get_SelectionContainer( IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple SelectionContainer { get; } + } + + /// + /// Provides access to controls that act as containers for a collection of individual, selectable child items. The children of this + /// control must implement ISelectionItemProvider. + /// + /// + /// This interface is implemented by a UI Automation provider. + /// Providers should raise an event of type UIA_Selection_InvalidatedEventId when a selection in a container has changed significantly. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ISelectionProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("fb8b03af-3bdf-48d4-bd36-1a65793be168")] + public interface ISelectionProvider + { + /// Retrieves a Microsoft UI Automation provider for each child element that is selected. + /// + /// Type: SAFEARRAY** + /// + /// Receives a pointer to a SAFEARRAY that contains an array of pointers to the IRawElementProviderSimple interfaces of the selected + /// elements. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider-getselection HRESULT + // GetSelection( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetSelection(); + + /// + /// Indicates whether the Microsoft UI Automation provider allows more than one child element to be selected concurrently. + /// This property is read-only. + /// + /// + /// + /// This property may be dynamic. For example, in rare cases a control might allow multiple items to be selected on initialization + /// but subsequently allow only single selections to be made. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider-get_canselectmultiple + // HRESULT get_CanSelectMultiple( BOOL *pRetVal ); + bool CanSelectMultiple { get; } + + /// + /// Indicates whether the Microsoft UI Automation provider requires at least one child element to be selected. + /// This property is read-only. + /// + /// + /// + /// This property can be dynamic. For example, the initial state of a control might not have any items selected by default, meaning + /// that ISelectionProvider::IsSelectionRequired is FALSE. However, after an item is selected the control must always + /// have at least one item selected. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider-get_isselectionrequired + // HRESULT get_IsSelectionRequired( BOOL *pRetVal ); + bool IsSelectionRequired { get; } + } + + /// Extends the ISelectionItemProvider interface to provide information about selected items. + /// + /// This interface is implemented by a Microsoft UI Automation provider. + /// Providers should raise an event of type UIA_Selection_InvalidatedEventId when a selection in a container has changed significantly. + /// + /// When selecting from a list or 2D grid there are primary pieces of information that ATs would like to better read to their end users. + /// Using Excel as a primary example, there are 4 main pieces of information necessary for the AT to provide a good experience: + /// + /// + /// + /// The first cell in the selection + /// + /// + /// The last cell in the selection + /// + /// + /// The current item as you select + /// + /// + /// The total count + /// + /// + /// The above image illustrates the end state of a 2D selection: + /// + /// + /// The user started in cell F5 (note this is where focus input stays because if you type that is where data lands) + /// + /// + /// The user selects down the column to cell F7 + /// + /// + /// The user then selects left to cell D7 + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider2 + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ISelectionProvider2")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("14f68475-ee1c-44f6-a869-d239381f0fe7")] + public interface ISelectionProvider2 : ISelectionProvider + { + /// Retrieves a Microsoft UI Automation provider for each child element that is selected. + /// + /// Type: SAFEARRAY** + /// + /// Receives a pointer to a SAFEARRAY that contains an array of pointers to the IRawElementProviderSimple interfaces of the selected + /// elements. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider-getselection HRESULT + // GetSelection( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + new IRawElementProviderSimple[] GetSelection(); + + /// + /// Indicates whether the Microsoft UI Automation provider allows more than one child element to be selected concurrently. + /// This property is read-only. + /// + /// + /// + /// This property may be dynamic. For example, in rare cases a control might allow multiple items to be selected on initialization + /// but subsequently allow only single selections to be made. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider-get_canselectmultiple + // HRESULT get_CanSelectMultiple( BOOL *pRetVal ); + new bool CanSelectMultiple { get; } + + /// + /// Indicates whether the Microsoft UI Automation provider requires at least one child element to be selected. + /// This property is read-only. + /// + /// + /// + /// This property can be dynamic. For example, the initial state of a control might not have any items selected by default, meaning + /// that ISelectionProvider::IsSelectionRequired is FALSE. However, after an item is selected the control must always + /// have at least one item selected. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider-get_isselectionrequired + // HRESULT get_IsSelectionRequired( BOOL *pRetVal ); + new bool IsSelectionRequired { get; } + + /// + /// Gets the first item in a group of selected items. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider2-get_firstselecteditem + // HRESULT get_FirstSelectedItem( IRawElementProviderSimple **retVal ); + IRawElementProviderSimple FirstSelectedItem { get; } + + /// + /// Gets the last item in a group of selected items. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider2-get_lastselecteditem + // HRESULT get_LastSelectedItem( IRawElementProviderSimple **retVal ); + IRawElementProviderSimple LastSelectedItem { get; } + + /// + /// Gets the currently selected item. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider2-get_currentselecteditem + // HRESULT get_CurrentSelectedItem( IRawElementProviderSimple **retVal ); + IRawElementProviderSimple CurrentSelectedItem { get; } + + /// + /// Gets the number of selected items. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iselectionprovider2-get_itemcount HRESULT + // get_ItemCount( int *retVal ); + int ItemCount { get; } + } + + /// Provides access to information about an item (cell) in a spreadsheet. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-ispreadsheetitemprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ISpreadsheetItemProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("eaed4660-7b3d-4879-a2e6-365ce603f3d0")] + public interface ISpreadsheetItemProvider + { + /// Retrieves an array of objects that represent the annotations associated with this spreadsheet cell. + /// + /// Type: SAFEARRAY** + /// + /// Receives an array of IRawElementProviderSimple interfaces that represent the annotations associated with the spreadsheet cell. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ispreadsheetitemprovider-getannotationobjects + // HRESULT GetAnnotationObjects( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetAnnotationObjects(); + + /// + /// Retrieves an array of annotation type identifiers indicating the types of annotations that are associated with this spreadsheet cell. + /// + /// + /// Type: SAFEARRAY** + /// + /// Receives an array of annotation type identifiers, one for each type of annotation associated with the spreadsheet cell. For a + /// list of possible values, see Annotation Type Identifiers. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ispreadsheetitemprovider-getannotationtypes + // HRESULT GetAnnotationTypes( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_I4)] + int[] GetAnnotationTypes(); + + /// + /// Specifies the formula for this spreadsheet cell. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ispreadsheetitemprovider-get_formula + // HRESULT get_Formula( BSTR *pRetVal ); + string Formula { [return: MarshalAs(UnmanagedType.BStr)] get; } + } + + /// Provides access to items (cells) in a spreadsheet. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-ispreadsheetprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ISpreadsheetProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6f6b5d35-5525-4f80-b758-85473832ffc7")] + public interface ISpreadsheetProvider + { + /// Exposes a UI Automation element that represents the spreadsheet cell that has the specified name. + /// + /// Type: LPCWSTR + /// The name of the target cell. + /// + /// + /// Type: IRawElementProviderSimple** + /// Receives the element that represents the target cell. + /// + /// A spreadsheet cell typically has a name such as “c5” or “a15”. A name can also apply to a range of cells. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ispreadsheetprovider-getitembyname + // HRESULT GetItemByName( [in] LPCWSTR name, [out, retval] IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple GetItemByName(string name); + } + + /// Provides access to the visual styles associated with the content of a document. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-istylesprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IStylesProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("19b6b649-f5d7-4a6d-bdcb-129252be588a")] + public interface IStylesProvider + { + /// + /// Identifies the visual style of an element in a document. + /// This property is read-only. + /// + /// + /// + /// + /// A provider should use this property to expose style identifiers that are useful to client applications. For example, a provider + /// might expose the StyleId_Title identifier for an element that represents the title of a presentation. A screen reader could then + /// retrieve the StyleId property, discover that the element is a presentation title, and read the title to the user. + /// + /// List Styles + /// IDs for list styles are supported starting with Windows 8.1. + /// + /// These styles should be applied at a paragraph level; all text that is part of a list item should have one of these styles applied + /// to it. + /// + /// + /// When bullet styles are mixed within a list, the BulletedList style should be applied to the whole range, and the + /// BulletStyle attribute value (property identified by UIA_BulletStyleAttributeId) should be mixed according to breakdown of + /// different bullet types within the range. + /// + /// + /// When nested lists contain bullets also (perhaps of a different type than the main list), the BulletedList style would + /// again be applied to the whole range, and the BulletStyle attribute value is whatever the nested bullet style is (for the + /// range covering the nested list). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_styleid HRESULT + // get_StyleId( int *retVal ); + int StyleId { get; } + + /// + /// Specifies the name of the visual style of an element in a document. + /// This property is read-only. + /// + /// + /// The style name typically indicates the role of the element in the document, such as "Heading 1." + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_stylename HRESULT + // get_StyleName( BSTR *retVal ); + string StyleName { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Specifies the fill color of an element in a document. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_fillcolor HRESULT + // get_FillColor( int *retVal ); + int FillColor { get; } + + /// + /// Specifies the fill pattern style of an element in a document. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_fillpatternstyle + // HRESULT get_FillPatternStyle( BSTR *retVal ); + string FillPatternStyle { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Specifies the shape of an element in a document. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_shape HRESULT + // get_Shape( BSTR *retVal ); + string Shape { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Specifies the color of the pattern used to fill an element in a document. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_fillpatterncolor + // HRESULT get_FillPatternColor( int *retVal ); + int FillPatternColor { get; } + + /// + /// + /// Contains additional properties that are not included in this control pattern, but that provide information about the document + /// content that might be useful to the user. + /// + /// This property is read-only. + /// + /// + /// The extended properties must be localized because they are intended to be consumed by the user. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-istylesprovider-get_extendedproperties + // HRESULT get_ExtendedProperties( BSTR *retVal ); + string ExtendedProperties { [return: MarshalAs(UnmanagedType.BStr)] get; } + } + + /// Enables Microsoft UI Automation client applications to direct the mouse or keyboard input to a specific UI element. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-isynchronizedinputprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ISynchronizedInputProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("29db1a06-02ce-4cf7-9b42-565d4fab20ee")] + public interface ISynchronizedInputProvider + { + /// Starts listening for input of the specified type. + /// + /// Type: SynchronizedInputType + /// The type of input that is requested to be synchronized. + /// + /// + /// + /// When it finds matching input, the provider checks if the target UI Automation element matches the current element. If they match, + /// the provider raises the UIA_InputReachedTargetEventId event; otherwise, it raises the UIA_InputReachedOtherElementEventId or + /// UIA_InputDiscardedEventId event. The UI Automation provider must discard the input if it is for an element other than this one. + /// + /// This is a one-shot method; after receiving input, the provider stops listening and continues normally. + /// This method returns E_INVALIDOPERATION if the provider is already listening for input. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-isynchronizedinputprovider-startlistening + // HRESULT StartListening( [in] SynchronizedInputType inputType ); + void StartListening(SynchronizedInputType inputType); + + /// Cancels listening for input. + /// If the provider is currently listening for input, it should revert to normal operation. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-isynchronizedinputprovider-cancel HRESULT Cancel(); + void Cancel(); + } + + /// Provides access to child controls of containers that implement ITableProvider. + /// + /// + /// This control pattern is analogous to IGridItemProvider with the distinction that any control implementing ITableItemProvider + /// must expose the relationship between the individual cell and its row and column information. + /// + /// Access to individual cell functionality is provided by the concurrent implementation of IGridItemProvider. + /// Implemented on a UI Automation provider that must support the TableItem control pattern. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itableitemprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITableItemProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("b9734fa6-771f-4d78-9c90-2517999349cd")] + public interface ITableItemProvider + { + /// + /// Retrieves a collection of Microsoft UI Automation provider representing all the row headers associated with a table item or cell. + /// + /// + /// Type: SAFEARRAY** + /// + /// Receives a pointer to a SAFEARRAY that contains an array of pointers to the IRawElementProviderSimple interfaces of the row + /// headers. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itableitemprovider-getrowheaderitems + // HRESULT GetRowHeaderItems( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetRowHeaderItems(); + + /// + /// Retrieves a collection of Microsoft UI Automation provider representing all the column headers associated with a table item or cell. + /// + /// + /// Type: SAFEARRAY** + /// + /// Receives a pointer to a SAFEARRAY that contains an array of pointers to the IRawElementProviderSimple interfaces of the column + /// headers. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itableitemprovider-getcolumnheaderitems + // HRESULT GetColumnHeaderItems( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetColumnHeaderItems(); + } + + /// + /// Provides access to controls that act as containers for a collection of child elements. The children of this element must implement + /// ITableItemProvider and be organized in a two-dimensional logical coordinate system that can be traversed by using the keyboard. + /// + /// + /// + /// This control pattern is analogous to IGridProvider with the distinction that any control that implements ITableProvider must + /// also expose a column and/or row header relationship for each child element. + /// + /// + /// Controls that implement ITableProvider are also required to implement IGridProvider so as to expose the inherent grid + /// functionality of a table control. + /// + /// Implemented on a UI Automation provider that must support the Table control pattern and Grid control pattern. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itableprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITableProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9c860395-97b3-490a-b52a-858cc22af166")] + public interface ITableProvider + { + /// Gets a collection of Microsoft UI Automation providers that represents all the row headers in a table. + /// + /// Type: SAFEARRAY** + /// + /// Receives a pointer to a SAFEARRAY that contains an array of pointers to the IRawElementProviderSimple interfaces of the row + /// headers. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itableprovider-getrowheaders HRESULT + // GetRowHeaders( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetRowHeaders(); + + /// Gets a collection of Microsoft UI Automation providers that represents all the column headers in a table. + /// + /// Type: SAFEARRAY** + /// + /// Receives a pointer to a SAFEARRAY that contains an array of pointers to the IRawElementProviderSimple interfaces of the column + /// headers. This parameter is passed uninitialized. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itableprovider-getcolumnheaders HRESULT + // GetColumnHeaders( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetColumnHeaders(); + + /// + /// Specifies the primary direction of traversal for the table. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itableprovider-get_roworcolumnmajor + // HRESULT get_RowOrColumnMajor( RowOrColumnMajor *pRetVal ); + RowOrColumnMajor RowOrColumnMajor { get; } + } + + /// + /// Provides access to a text-based control (or an object embedded in text) that is a child or descendant of another text-based control. + /// + /// + /// + /// An element that implements the TextChild control pattern must be a child, or descendent, of an element that supports the Text control pattern. + /// + /// It is not required that this element also implement the Text control pattern. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itextchildprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITextChildProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4c2de2b9-c88f-4f88-a111-f1d336b7d1a9")] + public interface ITextChildProvider + { + /// + /// Retrieves this element's nearest ancestor provider that supports the Text control pattern. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextchildprovider-get_textcontainer + // HRESULT get_TextContainer( IRawElementProviderSimple **pRetVal ); + IRawElementProviderSimple TextContainer { get; } + + /// + /// Retrieves a text range that encloses this child element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextchildprovider-get_textrange HRESULT + // get_TextRange( ITextRangeProvider **pRetVal ); + ITextRangeProvider TextRange { get; } + } + + /// Extends the ITextProvider interface to enable Microsoft UI Automation providers to expose programmatic text-edit actions. + /// + /// Call the UiaRaiseTextEditTextChangedEvent function to raise the UI Automation events that notify clients of changes. Use values of + /// TextEditChangeType to describe the change. Follow the guidance given in TextEdit Control Pattern that describes when to raise the + /// events and what payload the events should pass to UI Automation. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itexteditprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITextEditProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("ea3605b4-3a05-400e-b5f9-4e91b40f6176")] + public interface ITextEditProvider : ITextProvider + { + /// Retrieves a collection of text ranges that represents the currently selected text in a text-based control. + /// + /// Type: SAFEARRAY** + /// + /// Receives the address of an array of pointers to the ITextRangeProvider interfaces of the text ranges, one for each selected span + /// of text. This parameter is passed uninitialized. + /// + /// + /// + /// + /// For UI Automation providers that support text selection, the provider should implement this method and also return a + /// ITextProvider::SupportedTextSelection value. + /// + /// If the control contains only a single span of selected text, the pRetVal array should contain a single text range. + /// + /// If the control contains a text insertion point but no text is selected, the pRetVal array should contain a degenerate + /// (empty) text range at the position of the text insertion point. + /// + /// + /// If the control contains no selected text, or if the control does not contain a text insertion point, set pRetVal to NULL. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getselection HRESULT + // GetSelection( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + new ITextRangeProvider[] GetSelection(); + + /// + /// Retrieves an array of disjoint text ranges from a text-based control where each text range represents a contiguous span of + /// visible text. + /// + /// + /// Type: SAFEARRAY** + /// + /// Receives the address of an array of pointers to the ITextRangeProvider interfaces of the visible text ranges or an empty array. A + /// NULL reference is never returned. This parameter is passed uninitialized. + /// + /// + /// + /// + /// If the visible text consists of one contiguous span of text, the pRetVal array should contain a single text range that + /// represents all of the visible text. + /// + /// + /// If the visible text consists of multiple, disjoint spans of text, the pRetVal array should contain one text range for each + /// visible span, beginning with the first visible span, and ending with the last visible span. Disjoint spans of visible text can + /// occur when the content of a text-based control is partially obscured by an overlapping window or other object, or when a + /// text-based control with multiple pages or columns has content that is partially scrolled out of view. + /// + /// + /// ITextProvider::GetVisibleRanges should return a degenerate (empty) text range if no text is visible, if all text is + /// scrolled out of view, or if the text-based control contains no text. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getvisibleranges HRESULT + // GetVisibleRanges( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + new ITextRangeProvider[] GetVisibleRanges(); + + /// + /// Retrieves a text range that encloses the specified child element (for example, an image, hyperlink, or other embedded object). + /// + /// The UI Automation provider of the specified child element. + /// + /// The text range that encloses the child element. + /// This range completely encloses the content of the child element such that: + /// + /// + /// ITextRangeProvider::GetEnclosingElement returns the child element itself, or the innermost descendant of the child element that + /// shares the same text range as the child element + /// + /// ITextRangeProvider::GetChildren returns children of the element from (1) that are completely enclosed within the range + /// Both endpoints of the range are at the boundaries of the child element + /// + /// This parameter is passed uninitialized. + /// + new ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement); + + /// Returns the degenerate (empty) text range nearest to the specified screen coordinates. + /// + /// Type: UiaPoint + /// The location in screen coordinates. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the degenerate (empty) text range nearest the specified location. This parameter is passed uninitialized. + /// + /// + /// + /// A text range that encloses a child object is returned if the screen coordinates are within the coordinates of an image, + /// hyperlink, or other embedded object. + /// + /// + /// Because hidden text is not ignored by ITextProvider::RangeFromPoint, a degenerate range from the visible text closest to + /// the given point is returned. + /// + /// The property never returns NULL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint HRESULT + // RangeFromPoint( [in] UiaPoint point, [out, retval] ITextRangeProvider **pRetVal ); + new ITextRangeProvider RangeFromPoint(UiaPoint point); + + /// + /// Retrieves a text range that encloses the main text of a document. + /// This property is read-only. + /// + /// + /// Some auxiliary text such as headers, footnotes, or annotations may not be included. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_documentrange HRESULT + // get_DocumentRange( ITextRangeProvider **pRetVal ); + new ITextRangeProvider DocumentRange { get; } + + /// + /// Retrieves a value that specifies the type of text selection that is supported by the control. + /// This property is read-only. + /// + /// + /// + /// [out] + /// Type: SupportedTextSelection* + /// When this function returns, contains a pointer to the SupportedTextSelection object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_supportedtextselection + // HRESULT get_SupportedTextSelection (SupportedTextSelection *pRetVal); + new SupportedTextSelection SupportedTextSelection { get; } + + /// Returns the active composition. + /// + /// Type: ITextRangeProvider** + /// Pointer to the range of the current conversion (none if there is no conversion). + /// + /// + /// Follow the guidance given in TextEdit Control Pattern that describes how to implement this method and how to raise the related + /// notification events. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itexteditprovider-getactivecomposition + // HRESULT GetActiveComposition( [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider GetActiveComposition(); + + /// Returns the current conversion target range. + /// + /// Type: ITextRangeProvider** + /// Pointer to the conversion target range (none if there is no conversion). + /// + /// + /// Follow the guidance given in TextEdit Control Pattern that describes how to implement this method and how to raise the related + /// notification events. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itexteditprovider-getconversiontarget + // HRESULT GetConversionTarget( [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider GetConversionTarget(); + } + + /// Provides access to controls that contain text. + /// Implemented on a Microsoft UI Automation provider that must support the Text control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itextprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITextProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("3589c92c-63f3-4367-99bb-ada653b77cf2")] + public interface ITextProvider + { + /// Retrieves a collection of text ranges that represents the currently selected text in a text-based control. + /// + /// Type: SAFEARRAY** + /// + /// Receives the address of an array of pointers to the ITextRangeProvider interfaces of the text ranges, one for each selected span + /// of text. This parameter is passed uninitialized. + /// + /// + /// + /// + /// For UI Automation providers that support text selection, the provider should implement this method and also return a + /// ITextProvider::SupportedTextSelection value. + /// + /// If the control contains only a single span of selected text, the pRetVal array should contain a single text range. + /// + /// If the control contains a text insertion point but no text is selected, the pRetVal array should contain a degenerate + /// (empty) text range at the position of the text insertion point. + /// + /// + /// If the control contains no selected text, or if the control does not contain a text insertion point, set pRetVal to NULL. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getselection HRESULT + // GetSelection( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + ITextRangeProvider[] GetSelection(); + + /// + /// Retrieves an array of disjoint text ranges from a text-based control where each text range represents a contiguous span of + /// visible text. + /// + /// + /// Type: SAFEARRAY** + /// + /// Receives the address of an array of pointers to the ITextRangeProvider interfaces of the visible text ranges or an empty array. A + /// NULL reference is never returned. This parameter is passed uninitialized. + /// + /// + /// + /// + /// If the visible text consists of one contiguous span of text, the pRetVal array should contain a single text range that + /// represents all of the visible text. + /// + /// + /// If the visible text consists of multiple, disjoint spans of text, the pRetVal array should contain one text range for each + /// visible span, beginning with the first visible span, and ending with the last visible span. Disjoint spans of visible text can + /// occur when the content of a text-based control is partially obscured by an overlapping window or other object, or when a + /// text-based control with multiple pages or columns has content that is partially scrolled out of view. + /// + /// + /// ITextProvider::GetVisibleRanges should return a degenerate (empty) text range if no text is visible, if all text is + /// scrolled out of view, or if the text-based control contains no text. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getvisibleranges HRESULT + // GetVisibleRanges( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + ITextRangeProvider[] GetVisibleRanges(); + + /// + /// Retrieves a text range that encloses the specified child element (for example, an image, hyperlink, or other embedded object). + /// + /// The UI Automation provider of the specified child element. + /// + /// The text range that encloses the child element. + /// This range completely encloses the content of the child element such that: + /// + /// + /// ITextRangeProvider::GetEnclosingElement returns the child element itself, or the innermost descendant of the child element that + /// shares the same text range as the child element + /// + /// ITextRangeProvider::GetChildren returns children of the element from (1) that are completely enclosed within the range + /// Both endpoints of the range are at the boundaries of the child element + /// + /// This parameter is passed uninitialized. + /// + ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement); + + /// Returns the degenerate (empty) text range nearest to the specified screen coordinates. + /// + /// Type: UiaPoint + /// The location in screen coordinates. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the degenerate (empty) text range nearest the specified location. This parameter is passed uninitialized. + /// + /// + /// + /// A text range that encloses a child object is returned if the screen coordinates are within the coordinates of an image, + /// hyperlink, or other embedded object. + /// + /// + /// Because hidden text is not ignored by ITextProvider::RangeFromPoint, a degenerate range from the visible text closest to + /// the given point is returned. + /// + /// The property never returns NULL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint HRESULT + // RangeFromPoint( [in] UiaPoint point, [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider RangeFromPoint(UiaPoint point); + + /// + /// Retrieves a text range that encloses the main text of a document. + /// This property is read-only. + /// + /// + /// Some auxiliary text such as headers, footnotes, or annotations may not be included. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_documentrange HRESULT + // get_DocumentRange( ITextRangeProvider **pRetVal ); + ITextRangeProvider DocumentRange { get; } + + /// + /// Retrieves a value that specifies the type of text selection that is supported by the control. + /// This property is read-only. + /// + /// + /// + /// [out] + /// Type: SupportedTextSelection* + /// When this function returns, contains a pointer to the SupportedTextSelection object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_supportedtextselection + // HRESULT get_SupportedTextSelection (SupportedTextSelection *pRetVal); + SupportedTextSelection SupportedTextSelection { get; } + } + + /// + /// Extends the ITextProvider interface to enable Microsoft UI Automation providers to expose textual content that is the target of an + /// annotation, and information about a caret that belongs to the provider. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itextprovider2 + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITextProvider2")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0dc5e6ed-3e16-4bf1-8f9a-a979878bc195")] + public interface ITextProvider2 : ITextProvider + { + /// Retrieves a collection of text ranges that represents the currently selected text in a text-based control. + /// + /// Type: SAFEARRAY** + /// + /// Receives the address of an array of pointers to the ITextRangeProvider interfaces of the text ranges, one for each selected span + /// of text. This parameter is passed uninitialized. + /// + /// + /// + /// + /// For UI Automation providers that support text selection, the provider should implement this method and also return a + /// ITextProvider::SupportedTextSelection value. + /// + /// If the control contains only a single span of selected text, the pRetVal array should contain a single text range. + /// + /// If the control contains a text insertion point but no text is selected, the pRetVal array should contain a degenerate + /// (empty) text range at the position of the text insertion point. + /// + /// + /// If the control contains no selected text, or if the control does not contain a text insertion point, set pRetVal to NULL. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getselection HRESULT + // GetSelection( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + new ITextRangeProvider[] GetSelection(); + + /// + /// Retrieves an array of disjoint text ranges from a text-based control where each text range represents a contiguous span of + /// visible text. + /// + /// + /// Type: SAFEARRAY** + /// + /// Receives the address of an array of pointers to the ITextRangeProvider interfaces of the visible text ranges or an empty array. A + /// NULL reference is never returned. This parameter is passed uninitialized. + /// + /// + /// + /// + /// If the visible text consists of one contiguous span of text, the pRetVal array should contain a single text range that + /// represents all of the visible text. + /// + /// + /// If the visible text consists of multiple, disjoint spans of text, the pRetVal array should contain one text range for each + /// visible span, beginning with the first visible span, and ending with the last visible span. Disjoint spans of visible text can + /// occur when the content of a text-based control is partially obscured by an overlapping window or other object, or when a + /// text-based control with multiple pages or columns has content that is partially scrolled out of view. + /// + /// + /// ITextProvider::GetVisibleRanges should return a degenerate (empty) text range if no text is visible, if all text is + /// scrolled out of view, or if the text-based control contains no text. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getvisibleranges HRESULT + // GetVisibleRanges( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + new ITextRangeProvider[] GetVisibleRanges(); + + /// + /// Retrieves a text range that encloses the specified child element (for example, an image, hyperlink, or other embedded object). + /// + /// The UI Automation provider of the specified child element. + /// + /// The text range that encloses the child element. + /// This range completely encloses the content of the child element such that: + /// + /// + /// ITextRangeProvider::GetEnclosingElement returns the child element itself, or the innermost descendant of the child element that + /// shares the same text range as the child element + /// + /// ITextRangeProvider::GetChildren returns children of the element from (1) that are completely enclosed within the range + /// Both endpoints of the range are at the boundaries of the child element + /// + /// This parameter is passed uninitialized. + /// + new ITextRangeProvider RangeFromChild(IRawElementProviderSimple childElement); + + /// Returns the degenerate (empty) text range nearest to the specified screen coordinates. + /// + /// Type: UiaPoint + /// The location in screen coordinates. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the degenerate (empty) text range nearest the specified location. This parameter is passed uninitialized. + /// + /// + /// + /// A text range that encloses a child object is returned if the screen coordinates are within the coordinates of an image, + /// hyperlink, or other embedded object. + /// + /// + /// Because hidden text is not ignored by ITextProvider::RangeFromPoint, a degenerate range from the visible text closest to + /// the given point is returned. + /// + /// The property never returns NULL. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint HRESULT + // RangeFromPoint( [in] UiaPoint point, [out, retval] ITextRangeProvider **pRetVal ); + new ITextRangeProvider RangeFromPoint(UiaPoint point); + + /// + /// Retrieves a text range that encloses the main text of a document. + /// This property is read-only. + /// + /// + /// Some auxiliary text such as headers, footnotes, or annotations may not be included. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_documentrange HRESULT + // get_DocumentRange( ITextRangeProvider **pRetVal ); + new ITextRangeProvider DocumentRange { get; } + + /// + /// Retrieves a value that specifies the type of text selection that is supported by the control. + /// This property is read-only. + /// + /// + /// + /// [out] + /// Type: SupportedTextSelection* + /// When this function returns, contains a pointer to the SupportedTextSelection object. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_supportedtextselection + // HRESULT get_SupportedTextSelection (SupportedTextSelection *pRetVal); + new SupportedTextSelection SupportedTextSelection { get; } + + /// + /// Exposes a text range that contains the text that is the target of the annotation associated with the specified annotation element. + /// + /// + /// Type: IRawElementProviderSimple* + /// + /// The provider for an element that implements the IAnnotationProvider interface. The annotation element is a sibling of the element + /// that implements the ITextProvider2 interface for the document. + /// + /// + /// + /// Type: ITextRangeProvider** + /// Receives a text range that contains the annotation target text. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider2-rangefromannotation + // HRESULT RangeFromAnnotation( [in] IRawElementProviderSimple *annotationElement, [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider RangeFromAnnotation(IRawElementProviderSimple annotationElement); + + /// Provides a zero-length text range at the location of the caret that belongs to the text-based control. + /// + /// Type: BOOL* + /// TRUE if the text-based control that contains the caret has keyboard focus, otherwise FALSE. + /// + /// + /// Type: ITextRangeProvider** + /// A text range that represents the current location of the caret that belongs to the text-based control. + /// + /// + /// + /// If the isActive parameter is FALSE, the caret that belongs to the text-based control might not be at the same + /// location as the system caret. + /// + /// + /// This method retrieves a text range that a client can use to find the bounding rectangle of the caret that belongs to the + /// text-based control, or to find the text near the caret. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider2-getcaretrange HRESULT + // GetCaretRange( [out] BOOL *isActive, [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider GetCaretRange(out bool isActive); + } + + /// Provides access to a span of continuous text in a text container that implements ITextProvider or ITextProvider2. + /// A range can represent an insertion point, a portion of text, or all of the text in a container. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itextrangeprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITextRangeProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("5347ad7b-c355-46f8-aff5-909033582f63")] + public interface ITextRangeProvider + { + /// + /// Returns a new ITextRangeProvider identical to the original ITextRangeProvider and inheriting all properties of the original. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the copy of the text range. A null reference is never returned. This parameter is passed uninitialized. + /// + /// The new range can be manipulated independently from the original. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-clone HRESULT Clone( + // [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider Clone(); + + /// Retrieves a value that specifies whether this text range has the same endpoints as another text range. + /// + /// Type: ITextRangeProvider* + /// The text range to compare with this one. + /// + /// + /// Type: BOOL* + /// Receives TRUE if the text ranges have the same endpoints, or FALSE if they do not. + /// + /// + /// This method compares the endpoints of the two text ranges, not the text in the ranges. The ranges are identical if they share the + /// same endpoints. If two text ranges have different endpoints, they are not identical even if the text in both ranges is exactly + /// the same. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-compare HRESULT + // Compare( [in] ITextRangeProvider *range, [out, retval] BOOL *pRetVal ); + bool Compare(ITextRangeProvider range); + + /// Returns a value that specifies whether two text ranges have identical endpoints. + /// + /// + /// Type: ITextRangeProvider* + /// The text range to be compared. + /// + /// + /// + /// Type: int* + /// Receives a value that indicates whether the two text ranges have identical endpoints. This parameter is passed uninitialized. + /// + /// + /// Returns a negative value if the caller's endpoint occurs earlier in the text than the target endpoint. + /// Returns zero if the caller's endpoint is at the same location as the target endpoint. + /// Returns a positive value if the caller's endpoint occurs later in the text than the target endpoint. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-compareendpoints + // HRESULT CompareEndpoints( TextPatternRangeEndpoint endpoint, [in] ITextRangeProvider *targetRange, TextPatternRangeEndpoint + // targetEndpoint, [out, retval] int *pRetVal ); + int CompareEndpoints(TextPatternRangeEndpoint endpoint, ITextRangeProvider targetRange, TextPatternRangeEndpoint targetEndpoint); + + /// + /// Normalizes the text range by the specified text unit. The range is expanded if it is smaller than the specified unit, or + /// shortened if it is longer than the specified unit. + /// + /// + /// Type: TextUnit + /// The type of text units, such as character, word, paragraph, and so on. + /// + /// + /// + /// Client applications such as screen readers use this method to retrieve the full word, sentence, or paragraph that exists at the + /// insertion point or caret position. + /// + /// + /// Despite its name, the ITextRangeProvider::ExpandToEnclosingUnit method does not necessarily expand a text range. Instead, + /// it "normalizes" a text range by moving the endpoints so that the range encompasses the specified text unit. The range is expanded + /// if it is smaller than the specified unit, or shortened if it is longer than the specified unit. If the range is already an exact + /// quantity of the specified units, it remains unchanged. It is critical that the ExpandToEnclosingUnit method always + /// normalizes text ranges in a consistent manner; otherwise, other aspects of text range manipulation by text unit would be + /// unpredictable. The following diagram shows how ExpandToEnclosingUnit normalizes a text range by moving the endpoints of + /// the range. + /// + /// + /// ExpandToEnclosingUnit defaults to the next largest text unit supported if the specified text unit is not supported by the + /// control. The order, from smallest unit to largest, is as follows: + /// + /// + /// + /// Character + /// + /// + /// Format + /// + /// + /// Word + /// + /// + /// Line + /// + /// + /// Paragraph + /// + /// + /// Page + /// + /// + /// Document + /// + /// + /// ExpandToEnclosingUnit respects both visible and hidden text. + /// Range behavior when unit is + /// + /// as a unit value positions the boundary of a text range to expand or move the range based on shared text attributes + /// (format) of the text within the range. However, using the format text unit should not move or expand a text range across the + /// boundary of an embedded object, such as an image or hyperlink. For more info, see UI Automation Text Units or Text and TextRange + /// Control Patterns. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-expandtoenclosingunit + // HRESULT ExpandToEnclosingUnit( [in] TextUnit unit ); + void ExpandToEnclosingUnit(TextUnit unit); + + /// Returns a text range subset that has the specified text attribute value. + /// + /// Type: TEXTATTRIBUTEID + /// The identifier of the text attribute. For a list of text attribute IDs, see Text Attribute Identifiers. + /// + /// + /// Type: VARIANT + /// The attribute value to search for. This value must match the type specified for the attribute. + /// + /// + /// Type: BOOL + /// TRUE if the last occurring text range should be returned instead of the first; otherwise FALSE. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the text range having a matching attribute and attribute value; otherwise NULL. + /// + /// + /// The FindAttribute method retrieves matching text regardless of whether the text is hidden or visible. Clients can use + /// UIA_IsHiddenAttributeId to check text visibility. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-findattribute HRESULT + // FindAttribute( [in] TEXTATTRIBUTEID attributeId, [in] VARIANT val, [in] BOOL backward, [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider FindAttribute(UIAutomationClient.TEXTATTRIBUTEID attributeId, object val, bool backward); + + /// Returns a text range subset that contains the specified text. + /// + /// Type: BSTR + /// The text string to search for. + /// + /// + /// Type: BOOL + /// TRUE if the last occurring text range should be returned instead of the first; otherwise FALSE. + /// + /// + /// Type: BOOL + /// TRUE if case should be ignored; otherwise FALSE. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the text range matching the specified text; otherwise NULL. This parameter is passed uninitialized. + /// + /// There is no differentiation between hidden and visible text. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-findtext HRESULT + // FindText( [in] BSTR text, [in] BOOL backward, [in] BOOL ignoreCase, [out, retval] ITextRangeProvider **pRetVal ); + ITextRangeProvider FindText([In, MarshalAs(UnmanagedType.BStr)] string text, bool backward, bool ignoreCase); + + /// Retrieves the value of the specified text attribute across the text range. + /// + /// Type: TEXTATTRIBUTEID + /// The identifier of the text attribute. For a list of text attribute IDs, see Text Attribute Identifiers. + /// + /// + /// Type: VARIANT* + /// Receives one of the following. + /// + /// + /// + /// The address of an object representing the value of the specified attribute. The data type of the value varies depending on the + /// specified attribute. For example, if attributeId is UIA_FontNameAttributeId, GetAttributeValue returns a string + /// that represents the font name of the text range, but if attributeId is UIA_IsItalicAttributeId, GetAttributeValue + /// returns a boolean. + /// + /// + /// + /// + /// The address of the value retrieved by the UiaGetReservedMixedAttributeValue function, if the value of the specified attribute + /// varies over the text range. + /// + /// + /// + /// + /// The address of the value retrieved by the UiaGetReservedNotSupportedValue function, if the specified attribute is not supported + /// by the provider or the control. + /// + /// + /// + /// This parameter is passed uninitialized. + /// + /// + /// The GetAttributeValue method should retrieve the attribute value regardless of whether the text is hidden or visible. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-getattributevalue + // HRESULT GetAttributeValue( [in] TEXTATTRIBUTEID attributeId, [out, retval] VARIANT *pRetVal ); + object GetAttributeValue(UIAutomationClient.TEXTATTRIBUTEID attributeId); + + /// Retrieves a collection of bounding rectangles for each fully or partially visible line of text in a text range. + /// + /// Type: SAFEARRAY** + /// Receives a pointer to one of the following. + /// + /// + /// An array of bounding rectangles for each full or partial line of text in a text range. + /// + /// + /// An empty array for a degenerate range. + /// + /// + /// + /// An empty array for a text range that has screen coordinates placing it completely off-screen, scrolled out of view, or obscured + /// by an overlapping window. + /// + /// + /// + /// This parameter is passed uninitialized. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-getboundingrectangles + // HRESULT GetBoundingRectangles( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_R8)] + double[] GetBoundingRectangles(); + + /// Returns the innermost element that encloses the specified text range. + /// + /// The UI Automation provider of the innermost element that encloses the specified ITextRangeProvider. + /// The enclosing element can span more than just the specified ITextRangeProvider. + /// If no enclosing element is found, the ITextProvider parent of the ITextRangeProvider is returned. + /// This parameter is passed uninitialized. + /// + IRawElementProviderSimple GetEnclosingElement(); + + /// Retrieves the plain text of the range. + /// + /// Type: int + /// The maximum length of the string to return. Use -1 if no limit is required. + /// + /// + /// Type: BSTR* + /// + /// Receives the plain text of the text range, possibly truncated at the specified maximum length. This parameter is passed uninitialized. + /// + /// + /// + /// ITextRangeProvider::GetText retrieves both hidden and visible text. + /// + /// If maxLength is greater than the length of the text span of the caller, the string returned will be the plain text of the + /// text range. + /// + /// + /// ITextRangeProvider::GetText will not be affected by the order of endpoints in the text flow; it will always return the + /// text between the start and end endpoints of the text range in the logical text flow order. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-gettext HRESULT + // GetText( [in] int maxLength, [out, retval] BSTR *pRetVal ); + [return: MarshalAs(UnmanagedType.BStr)] + string GetText(int maxLength); + + /// Moves the text range forward or backward by the specified number of text units. + /// + /// + /// Type: int + /// The number of text units to move. A positive value moves the text range forward. + /// A negative value moves the text range backward. Zero has no effect. + /// + /// + /// Type: int* + /// + /// The number of text units actually moved. This can be less than the number requested if either of the new text range endpoints is + /// greater than or less than the endpoints retrieved by the ITextProvider::DocumentRange method. This value can be negative if + /// navigation is happening in the backward direction. + /// + /// + /// + /// + /// ITextRangeProvider::Move should only move the text range to span a different part of the text, it should not alter the + /// text in any way. + /// + /// + /// For a non-degenerate (non-empty) text range, ITextRangeProvider::Move should normalize and move the text range by + /// performing the following steps. + /// + /// + /// + /// Collapse the text range to a degenerate (empty) range at the starting endpoint. + /// + /// + /// + /// If necessary, move the resulting text range backward in the document to the beginning of the requested unit boundary. + /// + /// + /// + /// Move the text range forward or backward in the document by the requested number of text unit boundaries. + /// + /// + /// + /// Expand the text range from the degenerate state by moving the ending endpoint forward by one requested text unit boundary. + /// + /// + /// + /// + /// If any of the preceding steps fail, the text range should be left unchanged. If the text range cannot be moved as far as the + /// requested number of text units, but can be moved by a smaller number of text units, the text range should be moved by the smaller + /// number of text units and pRetVal should be set to the number of text units moved successfully. + /// + /// + /// For a degenerate text range, ITextRangeProvider::Move should simply move the text insertion point by the specified number + /// of text units. + /// + /// When moving a text range, the provider should ignore the boundaries of any embedded objects in the text. + /// ITextRangeProvider::Move should respect both hidden and visible text. + /// + /// If a text-based control does not support the text unit specified by the unit parameter, the provider should substitute the + /// next larger supported text unit. + /// + /// The size of the text units, from smallest unit to largest, is as follows. + /// + /// + /// Character + /// + /// + /// Format + /// + /// + /// Word + /// + /// + /// Line + /// + /// + /// Paragraph + /// + /// + /// Page + /// + /// + /// Document + /// + /// + /// Range behavior when unit is + /// + /// as a unit value positions the boundary of a text range to expand or move the range based on shared text attributes + /// (format) of the text within the range. However, using the format text unit should not move or expand a text range across the + /// boundary of an embedded object, such as an image or hyperlink. For more info, see UI Automation Text Units or Text and TextRange + /// Control Patterns. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-move HRESULT Move( + // TextUnit unit, [in] int count, [out, retval] int *pRetVal ); + int Move(TextUnit unit, int count); + + /// Moves one endpoint of the text range the specified number of TextUnit units within the document range. + /// + /// + /// + /// Type: int + /// + /// The number of units to move. A positive value moves the endpoint forward. A negative value moves backward. A value of 0 has no effect. + /// + /// + /// + /// Type: int* + /// + /// Receives the number of units actually moved, which can be less than the number requested if moving the endpoint runs into the + /// beginning or end of the document. + /// + /// + /// + /// + /// The endpoint is moved forward or backward, as specified, to the next available unit boundary. If the original endpoint was + /// at the boundary of the specified text unit, the endpoint is moved to the next available text unit boundary, as shown in + /// the following illustration. + /// + /// + /// If the endpoint being moved crosses the other endpoint of the same text range, the other endpoint is also moved, + /// resulting in a degenerate range and ensuring the correct ordering of the endpoint (that is, that the start is always less + /// than or equal to the end). + /// + /// + /// ITextRangeProvider::MoveEndpointByUnit deprecates up to the next supported text unit if the given text unit is not + /// supported by the control. + /// + /// The order, from smallest unit to largest, is listed here. + /// + /// + /// Character + /// + /// + /// Format + /// + /// + /// Word + /// + /// + /// Line + /// + /// + /// Paragraph + /// + /// + /// Page + /// + /// + /// Document + /// + /// + /// Range behavior when unit is + /// + /// as a unit value positions the boundary of a text range to expand or move the range based on shared text attributes + /// (format) of the text within the range. However, using the format text unit should not move or expand a text range across the + /// boundary of an embedded object, such as an image or hyperlink. For more info, see UI Automation Text Units or Text and TextRange + /// Control Patterns. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-moveendpointbyunit + // HRESULT MoveEndpointByUnit( TextPatternRangeEndpoint endpoint, TextUnit unit, [in] int count, [out, retval] int *pRetVal ); + int MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, int count); + + /// Moves one endpoint of the current text range to the specified endpoint of a second text range. + /// + /// + /// Type: ITextRangeProvider* + /// A second text range from the same text provider as the current text range. + /// + /// + /// + /// If the endpoint being moved crosses the other endpoint of the same text range, that other endpoint is moved also, resulting in a + /// degenerate (empty) range and ensuring the correct ordering of the endpoints (that is, the start is always less than or equal to + /// the end). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-moveendpointbyrange + // HRESULT MoveEndpointByRange( TextPatternRangeEndpoint endpoint, [in] ITextRangeProvider *targetRange, TextPatternRangeEndpoint + // targetEndpoint ); + void MoveEndpointByRange(TextPatternRangeEndpoint endpoint, ITextRangeProvider targetRange, TextPatternRangeEndpoint targetEndpoint); + + /// Selects the span of text that corresponds to this text range, and removes any previous selection. + /// Providing a degenerate text range will move the text insertion point. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-select HRESULT Select(); + void Select(); + + /// + /// Adds the text range to the collection of selected text ranges in a control that supports multiple, disjoint spans of selected text. + /// + /// + /// The text insertion point moves to the area of the new selection. + /// + /// If this method is called on a degenerate text range, the text insertion point moves to the location of the text range but no text + /// is selected. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-addtoselection HRESULT AddToSelection(); + void AddToSelection(); + + /// + /// Removes the text range from the collection of selected text ranges in a control that supports multiple, disjoint spans of + /// selected text. + /// + /// + /// The text insertion point moves to the area of the removed selection. + /// + /// If this method is called on a degenerate text range, the text insertion point moves to the location of the text range but no text + /// is selected. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-removefromselection + // HRESULT RemoveFromSelection(); + void RemoveFromSelection(); + + /// Causes the text control to scroll vertically until the text range is visible in the viewport. + /// + /// Type: BOOL + /// + /// TRUE if the text control should be scrolled so the text range is flush with the top of the viewport; FALSE if it should be flush + /// with the bottom of the viewport. + /// + /// + /// + /// ITextRangeProvider::ScrollIntoView respects both hidden and visible text. + /// If the text range is hidden, the text control will scroll only if the hidden text has an anchor in the viewport. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-scrollintoview HRESULT + // ScrollIntoView( [in] BOOL alignToTop ); + void ScrollIntoView(bool alignToTop); + + /// + /// Retrieves a collection of all elements that are both contained (either partially or completely) within the specified text range, + /// and are child elements of the enclosing element for the specified text range. + /// + /// + /// + /// An array of pointers to the IRawElementProviderSimple interfaces for all child elements that are enclosed by the text range + /// (sorted by the Start endpoint of their ranges). + /// + /// If the text range does not include any child elements, an empty collection is returned. + /// This parameter is passed uninitialized. + /// + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + IRawElementProviderSimple[] GetChildren(); + } + + /// Extends the ITextRangeProvider interface to enable Microsoft UI Automation providers to invoke context menus. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itextrangeprovider2 + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITextRangeProvider2")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("9bbce42c-1921-4f18-89ca-dba1910a0386")] + public interface ITextRangeProvider2 : ITextRangeProvider + { + /// + /// Returns a new ITextRangeProvider identical to the original ITextRangeProvider and inheriting all properties of the original. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the copy of the text range. A null reference is never returned. This parameter is passed uninitialized. + /// + /// The new range can be manipulated independently from the original. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-clone HRESULT Clone( + // [out, retval] ITextRangeProvider **pRetVal ); + new ITextRangeProvider Clone(); + + /// Retrieves a value that specifies whether this text range has the same endpoints as another text range. + /// + /// Type: ITextRangeProvider* + /// The text range to compare with this one. + /// + /// + /// Type: BOOL* + /// Receives TRUE if the text ranges have the same endpoints, or FALSE if they do not. + /// + /// + /// This method compares the endpoints of the two text ranges, not the text in the ranges. The ranges are identical if they share the + /// same endpoints. If two text ranges have different endpoints, they are not identical even if the text in both ranges is exactly + /// the same. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-compare HRESULT + // Compare( [in] ITextRangeProvider *range, [out, retval] BOOL *pRetVal ); + new bool Compare(ITextRangeProvider range); + + /// Returns a value that specifies whether two text ranges have identical endpoints. + /// + /// + /// Type: ITextRangeProvider* + /// The text range to be compared. + /// + /// + /// + /// Type: int* + /// Receives a value that indicates whether the two text ranges have identical endpoints. This parameter is passed uninitialized. + /// + /// + /// Returns a negative value if the caller's endpoint occurs earlier in the text than the target endpoint. + /// Returns zero if the caller's endpoint is at the same location as the target endpoint. + /// Returns a positive value if the caller's endpoint occurs later in the text than the target endpoint. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-compareendpoints + // HRESULT CompareEndpoints( TextPatternRangeEndpoint endpoint, [in] ITextRangeProvider *targetRange, TextPatternRangeEndpoint + // targetEndpoint, [out, retval] int *pRetVal ); + new int CompareEndpoints(TextPatternRangeEndpoint endpoint, ITextRangeProvider targetRange, TextPatternRangeEndpoint targetEndpoint); + + /// + /// Normalizes the text range by the specified text unit. The range is expanded if it is smaller than the specified unit, or + /// shortened if it is longer than the specified unit. + /// + /// + /// Type: TextUnit + /// The type of text units, such as character, word, paragraph, and so on. + /// + /// + /// + /// Client applications such as screen readers use this method to retrieve the full word, sentence, or paragraph that exists at the + /// insertion point or caret position. + /// + /// + /// Despite its name, the ITextRangeProvider::ExpandToEnclosingUnit method does not necessarily expand a text range. Instead, + /// it "normalizes" a text range by moving the endpoints so that the range encompasses the specified text unit. The range is expanded + /// if it is smaller than the specified unit, or shortened if it is longer than the specified unit. If the range is already an exact + /// quantity of the specified units, it remains unchanged. It is critical that the ExpandToEnclosingUnit method always + /// normalizes text ranges in a consistent manner; otherwise, other aspects of text range manipulation by text unit would be + /// unpredictable. The following diagram shows how ExpandToEnclosingUnit normalizes a text range by moving the endpoints of + /// the range. + /// + /// + /// ExpandToEnclosingUnit defaults to the next largest text unit supported if the specified text unit is not supported by the + /// control. The order, from smallest unit to largest, is as follows: + /// + /// + /// + /// Character + /// + /// + /// Format + /// + /// + /// Word + /// + /// + /// Line + /// + /// + /// Paragraph + /// + /// + /// Page + /// + /// + /// Document + /// + /// + /// ExpandToEnclosingUnit respects both visible and hidden text. + /// Range behavior when unit is + /// + /// as a unit value positions the boundary of a text range to expand or move the range based on shared text attributes + /// (format) of the text within the range. However, using the format text unit should not move or expand a text range across the + /// boundary of an embedded object, such as an image or hyperlink. For more info, see UI Automation Text Units or Text and TextRange + /// Control Patterns. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-expandtoenclosingunit + // HRESULT ExpandToEnclosingUnit( [in] TextUnit unit ); + new void ExpandToEnclosingUnit(TextUnit unit); + + /// Returns a text range subset that has the specified text attribute value. + /// + /// Type: TEXTATTRIBUTEID + /// The identifier of the text attribute. For a list of text attribute IDs, see Text Attribute Identifiers. + /// + /// + /// Type: VARIANT + /// The attribute value to search for. This value must match the type specified for the attribute. + /// + /// + /// Type: BOOL + /// TRUE if the last occurring text range should be returned instead of the first; otherwise FALSE. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the text range having a matching attribute and attribute value; otherwise NULL. + /// + /// + /// The FindAttribute method retrieves matching text regardless of whether the text is hidden or visible. Clients can use + /// UIA_IsHiddenAttributeId to check text visibility. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-findattribute HRESULT + // FindAttribute( [in] TEXTATTRIBUTEID attributeId, [in] VARIANT val, [in] BOOL backward, [out, retval] ITextRangeProvider **pRetVal ); + new ITextRangeProvider FindAttribute(UIAutomationClient.TEXTATTRIBUTEID attributeId, object val, bool backward); + + /// Returns a text range subset that contains the specified text. + /// + /// Type: BSTR + /// The text string to search for. + /// + /// + /// Type: BOOL + /// TRUE if the last occurring text range should be returned instead of the first; otherwise FALSE. + /// + /// + /// Type: BOOL + /// TRUE if case should be ignored; otherwise FALSE. + /// + /// + /// Type: ITextRangeProvider** + /// Receives a pointer to the text range matching the specified text; otherwise NULL. This parameter is passed uninitialized. + /// + /// There is no differentiation between hidden and visible text. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-findtext HRESULT + // FindText( [in] BSTR text, [in] BOOL backward, [in] BOOL ignoreCase, [out, retval] ITextRangeProvider **pRetVal ); + new ITextRangeProvider FindText([In, MarshalAs(UnmanagedType.BStr)] string text, bool backward, bool ignoreCase); + + /// Retrieves the value of the specified text attribute across the text range. + /// + /// Type: TEXTATTRIBUTEID + /// The identifier of the text attribute. For a list of text attribute IDs, see Text Attribute Identifiers. + /// + /// + /// Type: VARIANT* + /// Receives one of the following. + /// + /// + /// + /// The address of an object representing the value of the specified attribute. The data type of the value varies depending on the + /// specified attribute. For example, if attributeId is UIA_FontNameAttributeId, GetAttributeValue returns a string + /// that represents the font name of the text range, but if attributeId is UIA_IsItalicAttributeId, GetAttributeValue + /// returns a boolean. + /// + /// + /// + /// + /// The address of the value retrieved by the UiaGetReservedMixedAttributeValue function, if the value of the specified attribute + /// varies over the text range. + /// + /// + /// + /// + /// The address of the value retrieved by the UiaGetReservedNotSupportedValue function, if the specified attribute is not supported + /// by the provider or the control. + /// + /// + /// + /// This parameter is passed uninitialized. + /// + /// + /// The GetAttributeValue method should retrieve the attribute value regardless of whether the text is hidden or visible. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-getattributevalue + // HRESULT GetAttributeValue( [in] TEXTATTRIBUTEID attributeId, [out, retval] VARIANT *pRetVal ); + new object GetAttributeValue(UIAutomationClient.TEXTATTRIBUTEID attributeId); + + /// Retrieves a collection of bounding rectangles for each fully or partially visible line of text in a text range. + /// + /// Type: SAFEARRAY** + /// Receives a pointer to one of the following. + /// + /// + /// An array of bounding rectangles for each full or partial line of text in a text range. + /// + /// + /// An empty array for a degenerate range. + /// + /// + /// + /// An empty array for a text range that has screen coordinates placing it completely off-screen, scrolled out of view, or obscured + /// by an overlapping window. + /// + /// + /// + /// This parameter is passed uninitialized. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-getboundingrectangles + // HRESULT GetBoundingRectangles( [out, retval] SAFEARRAY **pRetVal ); + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_R8)] + new double[] GetBoundingRectangles(); + + /// Returns the innermost element that encloses the specified text range. + /// + /// The UI Automation provider of the innermost element that encloses the specified ITextRangeProvider. + /// The enclosing element can span more than just the specified ITextRangeProvider. + /// If no enclosing element is found, the ITextProvider parent of the ITextRangeProvider is returned. + /// This parameter is passed uninitialized. + /// + new IRawElementProviderSimple GetEnclosingElement(); + + /// Retrieves the plain text of the range. + /// + /// Type: int + /// The maximum length of the string to return. Use -1 if no limit is required. + /// + /// + /// Type: BSTR* + /// + /// Receives the plain text of the text range, possibly truncated at the specified maximum length. This parameter is passed uninitialized. + /// + /// + /// + /// ITextRangeProvider::GetText retrieves both hidden and visible text. + /// + /// If maxLength is greater than the length of the text span of the caller, the string returned will be the plain text of the + /// text range. + /// + /// + /// ITextRangeProvider::GetText will not be affected by the order of endpoints in the text flow; it will always return the + /// text between the start and end endpoints of the text range in the logical text flow order. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-gettext HRESULT + // GetText( [in] int maxLength, [out, retval] BSTR *pRetVal ); + [return: MarshalAs(UnmanagedType.BStr)] + new string GetText(int maxLength); + + /// Moves the text range forward or backward by the specified number of text units. + /// + /// + /// Type: int + /// The number of text units to move. A positive value moves the text range forward. + /// A negative value moves the text range backward. Zero has no effect. + /// + /// + /// Type: int* + /// + /// The number of text units actually moved. This can be less than the number requested if either of the new text range endpoints is + /// greater than or less than the endpoints retrieved by the ITextProvider::DocumentRange method. This value can be negative if + /// navigation is happening in the backward direction. + /// + /// + /// + /// + /// ITextRangeProvider::Move should only move the text range to span a different part of the text, it should not alter the + /// text in any way. + /// + /// + /// For a non-degenerate (non-empty) text range, ITextRangeProvider::Move should normalize and move the text range by + /// performing the following steps. + /// + /// + /// + /// Collapse the text range to a degenerate (empty) range at the starting endpoint. + /// + /// + /// + /// If necessary, move the resulting text range backward in the document to the beginning of the requested unit boundary. + /// + /// + /// + /// Move the text range forward or backward in the document by the requested number of text unit boundaries. + /// + /// + /// + /// Expand the text range from the degenerate state by moving the ending endpoint forward by one requested text unit boundary. + /// + /// + /// + /// + /// If any of the preceding steps fail, the text range should be left unchanged. If the text range cannot be moved as far as the + /// requested number of text units, but can be moved by a smaller number of text units, the text range should be moved by the smaller + /// number of text units and pRetVal should be set to the number of text units moved successfully. + /// + /// + /// For a degenerate text range, ITextRangeProvider::Move should simply move the text insertion point by the specified number + /// of text units. + /// + /// When moving a text range, the provider should ignore the boundaries of any embedded objects in the text. + /// ITextRangeProvider::Move should respect both hidden and visible text. + /// + /// If a text-based control does not support the text unit specified by the unit parameter, the provider should substitute the + /// next larger supported text unit. + /// + /// The size of the text units, from smallest unit to largest, is as follows. + /// + /// + /// Character + /// + /// + /// Format + /// + /// + /// Word + /// + /// + /// Line + /// + /// + /// Paragraph + /// + /// + /// Page + /// + /// + /// Document + /// + /// + /// Range behavior when unit is + /// + /// as a unit value positions the boundary of a text range to expand or move the range based on shared text attributes + /// (format) of the text within the range. However, using the format text unit should not move or expand a text range across the + /// boundary of an embedded object, such as an image or hyperlink. For more info, see UI Automation Text Units or Text and TextRange + /// Control Patterns. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-move HRESULT Move( + // TextUnit unit, [in] int count, [out, retval] int *pRetVal ); + new int Move(TextUnit unit, int count); + + /// Moves one endpoint of the text range the specified number of TextUnit units within the document range. + /// + /// + /// + /// Type: int + /// + /// The number of units to move. A positive value moves the endpoint forward. A negative value moves backward. A value of 0 has no effect. + /// + /// + /// + /// Type: int* + /// + /// Receives the number of units actually moved, which can be less than the number requested if moving the endpoint runs into the + /// beginning or end of the document. + /// + /// + /// + /// + /// The endpoint is moved forward or backward, as specified, to the next available unit boundary. If the original endpoint was + /// at the boundary of the specified text unit, the endpoint is moved to the next available text unit boundary, as shown in + /// the following illustration. + /// + /// + /// If the endpoint being moved crosses the other endpoint of the same text range, the other endpoint is also moved, + /// resulting in a degenerate range and ensuring the correct ordering of the endpoint (that is, that the start is always less + /// than or equal to the end). + /// + /// + /// ITextRangeProvider::MoveEndpointByUnit deprecates up to the next supported text unit if the given text unit is not + /// supported by the control. + /// + /// The order, from smallest unit to largest, is listed here. + /// + /// + /// Character + /// + /// + /// Format + /// + /// + /// Word + /// + /// + /// Line + /// + /// + /// Paragraph + /// + /// + /// Page + /// + /// + /// Document + /// + /// + /// Range behavior when unit is + /// + /// as a unit value positions the boundary of a text range to expand or move the range based on shared text attributes + /// (format) of the text within the range. However, using the format text unit should not move or expand a text range across the + /// boundary of an embedded object, such as an image or hyperlink. For more info, see UI Automation Text Units or Text and TextRange + /// Control Patterns. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-moveendpointbyunit + // HRESULT MoveEndpointByUnit( TextPatternRangeEndpoint endpoint, TextUnit unit, [in] int count, [out, retval] int *pRetVal ); + new int MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, int count); + + /// Moves one endpoint of the current text range to the specified endpoint of a second text range. + /// + /// + /// Type: ITextRangeProvider* + /// A second text range from the same text provider as the current text range. + /// + /// + /// + /// If the endpoint being moved crosses the other endpoint of the same text range, that other endpoint is moved also, resulting in a + /// degenerate (empty) range and ensuring the correct ordering of the endpoints (that is, the start is always less than or equal to + /// the end). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-moveendpointbyrange + // HRESULT MoveEndpointByRange( TextPatternRangeEndpoint endpoint, [in] ITextRangeProvider *targetRange, TextPatternRangeEndpoint + // targetEndpoint ); + new void MoveEndpointByRange(TextPatternRangeEndpoint endpoint, ITextRangeProvider targetRange, TextPatternRangeEndpoint targetEndpoint); + + /// Selects the span of text that corresponds to this text range, and removes any previous selection. + /// Providing a degenerate text range will move the text insertion point. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-select HRESULT Select(); + new void Select(); + + /// + /// Adds the text range to the collection of selected text ranges in a control that supports multiple, disjoint spans of selected text. + /// + /// + /// The text insertion point moves to the area of the new selection. + /// + /// If this method is called on a degenerate text range, the text insertion point moves to the location of the text range but no text + /// is selected. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-addtoselection HRESULT AddToSelection(); + new void AddToSelection(); + + /// + /// Removes the text range from the collection of selected text ranges in a control that supports multiple, disjoint spans of + /// selected text. + /// + /// + /// The text insertion point moves to the area of the removed selection. + /// + /// If this method is called on a degenerate text range, the text insertion point moves to the location of the text range but no text + /// is selected. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-removefromselection + // HRESULT RemoveFromSelection(); + new void RemoveFromSelection(); + + /// Causes the text control to scroll vertically until the text range is visible in the viewport. + /// + /// Type: BOOL + /// + /// TRUE if the text control should be scrolled so the text range is flush with the top of the viewport; FALSE if it should be flush + /// with the bottom of the viewport. + /// + /// + /// + /// ITextRangeProvider::ScrollIntoView respects both hidden and visible text. + /// If the text range is hidden, the text control will scroll only if the hidden text has an anchor in the viewport. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-scrollintoview HRESULT + // ScrollIntoView( [in] BOOL alignToTop ); + new void ScrollIntoView(bool alignToTop); + + /// + /// Retrieves a collection of all elements that are both contained (either partially or completely) within the specified text range, + /// and are child elements of the enclosing element for the specified text range. + /// + /// + /// + /// An array of pointers to the IRawElementProviderSimple interfaces for all child elements that are enclosed by the text range + /// (sorted by the Start endpoint of their ranges). + /// + /// If the text range does not include any child elements, an empty collection is returned. + /// This parameter is passed uninitialized. + /// + [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] + new IRawElementProviderSimple[] GetChildren(); + + /// Programmatically invokes a context menu on the target element. + /// + /// This method should return an error code if the context menu could not be invoked. + /// + /// ShowContextMenu should always show the context menu at the beginning end point of the range. This should be equivalent to + /// what would happen if the user pressed the context menu key or SHIFT + F10 with the insertion point at the beginning of the range. + /// + /// + /// If showing the context menu would typically result in the insertion point moving to a given location, then it should do so for + /// programmatically invoking ShowContextMenu for Microsoft UI Automation support also. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider2-showcontextmenu + // HRESULT ShowContextMenu(); + void ShowContextMenu(); + } + + /// Provides access to controls that can cycle through a set of states and maintain a state after it is set. + /// Implemented on a Microsoft UI Automation provider that must support the Toggle control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itoggleprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IToggleProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("56d00bd0-c4f4-433c-a836-1a52a57e0892")] + public interface IToggleProvider + { + /// Cycles through the toggle states of a control. + /// + /// A control must cycle through its ToggleState in this order: ToggleState_On, ToggleState_Off and, if supported, ToggleState_Indeterminate. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itoggleprovider-toggle HRESULT Toggle(); + void Toggle(); + + /// + /// Specifies the toggle state of the control. + /// This property is read-only. + /// + /// + /// + /// A control must cycle through its ToggleState in this order: ToggleState_On, ToggleState_Off and, if supported, ToggleState_Indeterminate. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itoggleprovider-get_togglestate HRESULT + // get_ToggleState( ToggleState *pRetVal ); + ToggleState ToggleState { get; } + } + + /// Provides access to controls that can be moved, resized, and/or rotated within a two-dimensional space. + /// + /// Implemented on a Microsoft UI Automation provider that must support the Transform control pattern. + /// + /// Support for this control pattern is not limited to objects on the desktop. This control pattern must also be implemented by the + /// children of a container object as long as the children can be moved, resized, or rotated freely within the boundaries of the container. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itransformprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITransformProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("6829ddc4-4f91-4ffa-b86f-bd3e2987cb4c")] + public interface ITransformProvider + { + /// Moves the control. + /// + /// Type: double + /// The absolute screen coordinates of the left side of the control. + /// + /// + /// Type: double + /// The absolute screen coordinates of the top of the control. + /// + /// + /// An object cannot be moved, resized or rotated such that its resulting screen location would be completely outside the coordinates + /// of its container and inaccessible to keyboard or mouse. For example, when a top-level window is moved completely off-screen or a + /// child object is moved outside the boundaries of the container's viewport. In these cases the object is placed as close to the + /// requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-move HRESULT Move( + // [in] double x, [in] double y ); + void Move(double x, double y); + + /// Resizes the control. + /// + /// Type: double + /// The new width of the window in pixels. + /// + /// + /// Type: double + /// The new height of the window in pixels. + /// + /// + /// When called on a control supporting split panes, this method might have the side effect of resizing other contiguous panes. + /// + /// An object cannot be moved, resized, or rotated such that its resulting screen location would be completely outside the + /// coordinates of its container and inaccessible to keyboard or mouse. For example, a top-level window moved completely off-screen + /// or a child object moved outside the boundaries of the container's viewport. In these cases the object is placed as close to the + /// requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-resize HRESULT Resize( + // [in] double width, [in] double height ); + void Resize(double width, double height); + + /// Rotates the control. + /// + /// Type: double + /// The number of degrees to rotate the control. A positive number rotates clockwise; a negative number rotates counterclockwise. + /// + /// + /// An object cannot be moved, resized, or rotated such that its resulting screen location would be completely outside the + /// coordinates of its container and inaccessible to keyboard or mouse. For example, a top-level window moved completely off-screen + /// or a child object moved outside the boundaries of the container's viewport. In these cases the object is placed as close to the + /// requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-rotate HRESULT Rotate( + // [in] double degrees ); + void Rotate(double degrees); + + /// + /// Indicates whether the control can be moved. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-get_canmove HRESULT + // get_CanMove( BOOL *pRetVal ); + bool CanMove { get; } + + /// + /// Indicates whether the control can be resized. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-get_canresize HRESULT + // get_CanResize( BOOL *pRetVal ); + bool CanResize { get; } + + /// + /// Indicates whether the control can be rotated. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-get_canrotate HRESULT + // get_CanRotate( BOOL *pRetVal ); + bool CanRotate { get; } + } + + /// + /// Extends the ITransformProvider interface to enable Microsoft UI Automation providers to expose properties to support the viewport + /// zooming functionality of a control. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itransformprovider2 + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.ITransformProvider2")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("4758742f-7ac2-460c-bc48-09fc09308a93")] + public interface ITransformProvider2 : ITransformProvider + { + /// Moves the control. + /// + /// Type: double + /// The absolute screen coordinates of the left side of the control. + /// + /// + /// Type: double + /// The absolute screen coordinates of the top of the control. + /// + /// + /// An object cannot be moved, resized or rotated such that its resulting screen location would be completely outside the coordinates + /// of its container and inaccessible to keyboard or mouse. For example, when a top-level window is moved completely off-screen or a + /// child object is moved outside the boundaries of the container's viewport. In these cases the object is placed as close to the + /// requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-move HRESULT Move( + // [in] double x, [in] double y ); + new void Move(double x, double y); + + /// Resizes the control. + /// + /// Type: double + /// The new width of the window in pixels. + /// + /// + /// Type: double + /// The new height of the window in pixels. + /// + /// + /// When called on a control supporting split panes, this method might have the side effect of resizing other contiguous panes. + /// + /// An object cannot be moved, resized, or rotated such that its resulting screen location would be completely outside the + /// coordinates of its container and inaccessible to keyboard or mouse. For example, a top-level window moved completely off-screen + /// or a child object moved outside the boundaries of the container's viewport. In these cases the object is placed as close to the + /// requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-resize HRESULT Resize( + // [in] double width, [in] double height ); + new void Resize(double width, double height); + + /// Rotates the control. + /// + /// Type: double + /// The number of degrees to rotate the control. A positive number rotates clockwise; a negative number rotates counterclockwise. + /// + /// + /// An object cannot be moved, resized, or rotated such that its resulting screen location would be completely outside the + /// coordinates of its container and inaccessible to keyboard or mouse. For example, a top-level window moved completely off-screen + /// or a child object moved outside the boundaries of the container's viewport. In these cases the object is placed as close to the + /// requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-rotate HRESULT Rotate( + // [in] double degrees ); + new void Rotate(double degrees); + + /// + /// Indicates whether the control can be moved. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-get_canmove HRESULT + // get_CanMove( BOOL *pRetVal ); + new bool CanMove { get; } + + /// + /// Indicates whether the control can be resized. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-get_canresize HRESULT + // get_CanResize( BOOL *pRetVal ); + new bool CanResize { get; } + + /// + /// Indicates whether the control can be rotated. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider-get_canrotate HRESULT + // get_CanRotate( BOOL *pRetVal ); + new bool CanRotate { get; } + + /// Zooms the viewport of the control. + /// + /// Type: double + /// + /// The amount to zoom the viewport, specified as a percentage. The provider should zoom the viewport to the nearest supported value. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider2-zoom HRESULT Zoom( + // [in] double zoom ); + void Zoom(double zoom); + + /// + /// Indicates whether the control supports zooming of its viewport. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider2-get_canzoom HRESULT + // get_CanZoom( BOOL *pRetVal ); + bool CanZoom { get; } + + /// + /// Retrieves the current zoom level of the element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider2-get_zoomlevel HRESULT + // get_ZoomLevel( double *pRetVal ); + double ZoomLevel { get; } + + /// + /// Retrieves the minimum zoom level of the element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider2-get_zoomminimum + // HRESULT get_ZoomMinimum( double *pRetVal ); + double ZoomMinimum { get; } + + /// + /// Retrieves the maximum zoom level of the element. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider2-get_zoommaximum + // HRESULT get_ZoomMaximum( double *pRetVal ); + double ZoomMaximum { get; } + + /// Zooms the viewport of the control by the specified logical unit. + /// The logical unit by which to increase or decrease the zoom of the viewport. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itransformprovider2-zoombyunit HRESULT + // ZoomByUnit( ZoomUnit zoomUnit ); + void ZoomByUnit(ZoomUnit zoomUnit); + } + + /// + /// Returns a client API wrapper object and to unmarshal property and method requests to an actual provider instance. The PatternHandler + /// object is stateless, so this can be implemented by a singleton. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iuiautomationpatternhandler + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IUIAutomationPatternHandler")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("d97022f3-a947-465e-8b2a-ac4315fa54e8")] + public interface IUIAutomationPatternHandler + { + /// Creates an object that enables a client application to interact with a custom control pattern. + /// + /// Type: IUIAutomationPatternInstance* + /// A pointer to the instance of the control pattern that will be used by the wrapper. + /// + /// + /// Type: IUnknown** + /// Receives a pointer to the wrapper object. + /// + /// + /// The wrapper object exposes methods and properties of the control pattern. The implementation of the wrapper class passes + /// these calls to Microsoft UI Automation by calling CallMethod and GetProperty. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationpatternhandler-createclientwrapper + // HRESULT CreateClientWrapper( [in] IUIAutomationPatternInstance *pPatternInstance, [out, retval] IUnknown **pClientWrapper ); + [return: MarshalAs(UnmanagedType.IUnknown)] + object CreateClientWrapper(IUIAutomationPatternInstance pPatternInstance); + + /// Dispatches a method or property getter to a custom control pattern provider. + /// + /// Type: IUnknown* + /// A pointer to the object that implements the control pattern provider. + /// + /// + /// Type: UINT + /// The index of the method or property getter. + /// + /// + /// Type: UIAutomationParameter* + /// A pointer to an array of structures that contain information about the parameters to be passed. + /// + /// + /// Type: UINT + /// The count of parameters in pParams. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationpatternhandler-dispatch + // HRESULT Dispatch( [in] IUnknown *pTarget, [in] UINT index, [in] const UIAutomationParameter *pParams, [in] UINT cParams ); + void Dispatch([In, MarshalAs(UnmanagedType.IUnknown)] object pTarget, uint index, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] UIAutomationParameter[] pParams, uint cParams); + } + + /// + /// Represents a control pattern object. The client API wrapper uses this interface to implement all property and method calls in terms + /// of the GetProperty and CallMethod methods. + /// + /// + /// This interface is implemented by Microsoft UI Automation and returned by methods such as GetCurrentPattern. The interface is passed + /// to CreateClientWrapper, where it is used to call the appropriate methods and property getters. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iuiautomationpatterninstance + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IUIAutomationPatternInstance")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("c03a7fe4-9431-409f-bed8-ae7c2299bc8d")] + public interface IUIAutomationPatternInstance + { + /// + /// The client wrapper object implements the IUIAutomation::get_CurrentX and + /// IUIAutomationElement::get_CachedX methods by calling this function, specifying the property by index. + /// + /// + /// Type: UINT + /// The index of the property. + /// + /// + /// Type: BOOL + /// TRUE if the property should be retrieved from the cache, otherwise FALSE. + /// + /// + /// + /// Type: void* + /// Receives the value of the property. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationpatterninstance-getproperty + // HRESULT GetProperty( [in] UINT index, [in] BOOL cached, UIAutomationType type, [out, retval] void *pPtr ); + void GetProperty(uint index, bool cached, UIAutomationType type, [Out] IntPtr pPtr); + + /// Client wrapper implements methods by calling this CallMethod function, specifying the parameters as an array of pointers. + /// + /// Type: UINT + /// The index of the method. + /// + /// + /// Type: UIAutomationParameter* + /// A pointer to an array of structures describing the parameters. + /// + /// + /// Type: UINT + /// The count of parameters in pParams. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationpatterninstance-callmethod + // HRESULT CallMethod( [in] UINT index, [in] const UIAutomationParameter *pParams, [in] UINT cParams ); + void CallMethod(uint index, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] UIAutomationParameter[] pParams, uint cParams); + } + + /// Exposes methods for registering new control patterns, properties, and events. + /// + /// The IUIAutomationRegistrar interface is exposed by the CUIAutomationRegistrar object. To obtain an instance of this object, + /// call the CoCreateInstance function with a class ID of CLSID_CUIAutomationRegistrar. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iuiautomationregistrar + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IUIAutomationRegistrar")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("8609c4ec-4a1a-4d88-a357-5a66e060e1cf"), CoClass(typeof(CUIAutomationRegistrar))] + public interface IUIAutomationRegistrar + { + /// Registers a third-party property. + /// + /// Type: UIAutomationPropertyInfo* + /// A pointer to a structure that contains information about the property to register. + /// + /// + /// Type: PropertyID* + /// Receives the property ID of the newly registered property. + /// + /// + /// The property ID can be used in various property methods, including GetCurrentPropertyValue, and CreatePropertyCondition. The same + /// value can be used as a WinEvent value for property change events in IAccessibleEx implementations. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationregistrar-registerproperty + // HRESULT RegisterProperty( [in] const UIAutomationPropertyInfo *property, [out] PROPERTYID *propertyId ); + void RegisterProperty(in UIAutomationPropertyInfo property, out UIAutomationClient.PROPERTYID propertyId); + + /// Registers a third-party Microsoft UI Automation event. + /// + /// Type: UIAutomationEventInfo* + /// A pointer to a structure that contains information about the event to register. + /// + /// + /// Type: EVENTID* + /// Receives the event identifier. For a list of event IDs, see Event Identifiers. + /// + /// The event ID can be used in various event methods, and as a WinEvent value for events in IAccessibleEx implementations. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationregistrar-registerevent + // HRESULT RegisterEvent( [in] const UIAutomationEventInfo *event, [out] EVENTID *eventId ); + void RegisterEvent(in UIAutomationEventInfo _event, out UIAutomationClient.EVENTID eventId); + + /// Registers a third-party control pattern. + /// + /// Type: UIAutomationPatternInfo* + /// A pointer to a structure that contains information about the control pattern to register. + /// + /// + /// Type: PATTERNID* + /// Receives the pattern identifier. + /// + /// + /// Type: PROPERTYID* + /// + /// Receives the property identifier for the pattern. This value can be used with UI Automation client methods to determine whether + /// the element supports the new pattern. This is equivalent to values such as UIA_IsInvokePatternAvailablePropertyId. + /// + /// + /// + /// Type: UINT + /// The number of properties supported by the control pattern. + /// + /// + /// Type: PROPERTYID* + /// Receives an array of identifiers for properties supported by the pattern. + /// + /// + /// Type: UINT + /// The number of events supported by the control pattern. + /// + /// + /// Type: EVENTID* + /// Receives an array of identifiers for events that are raised by the pattern. + /// + /// The pattern, property, and event IDs retrieved by this method can be used in IAccessibleEx implementations. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iuiautomationregistrar-registerpattern + // HRESULT RegisterPattern( [in] const UIAutomationPatternInfo *pattern, [out] PATTERNID *pPatternId, [out] PROPERTYID + // *pPatternAvailablePropertyId, [in] UINT propertyIdCount, [out] PROPERTYID *pPropertyIds, [in] UINT eventIdCount, [out] EVENTID + // *pEventIds ); + void RegisterPattern(in UIAutomationPatternInfo pattern, out UIAutomationClient.PATTERNID pPatternId, + out UIAutomationClient.PROPERTYID pPatternAvailablePropertyId, uint propertyIdCount, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] UIAutomationClient.PROPERTYID[] pPropertyIds, uint eventIdCount, + [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] UIAutomationClient.EVENTID[] pEventIds); + } + + /// + /// Provides access to controls that have an intrinsic value that does not span a range, and that can be represented as a string. + /// + /// + /// The value of the control may or may not be editable depending on the control and its settings. + /// Implemented on a Microsoft UI Automation provider that must support the Value control pattern. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-ivalueprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IValueProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("c7935180-6fb3-4201-b174-7df73adbf64a")] + public interface IValueProvider + { + /// Sets the value of control. + /// + /// Type: LPCWSTR + /// The value to set. The provider is responsible for converting the value to the appropriate data type. + /// + /// + /// + /// Single-line edit controls support programmatic access to their contents by implementing IValueProvider. However, multi-line edit + /// controls do not implement IValueProvider; instead they provide access to their content by implementing ITextProvider. + /// + /// + /// Controls such as ListItem and TreeItem must implement IValueProvider if the value of any of the items is editable, regardless of + /// the current edit mode of the control. The parent control must also implement IValueProvider if the child items are editable. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ivalueprovider-setvalue HRESULT SetValue( + // [in] LPCWSTR val ); + void SetValue(string val); + + /// + /// The value of the control. + /// This property is read-only. + /// + /// + /// + /// + /// Single-line edit controls support programmatic access to their contents by implementing IValueProvider (in addition to + /// ITextProvider). However, multi-line edit controls do not implement IValueProvider. + /// + /// + /// To retrieve the textual contents of multi-line edit controls, the controls must implement ITextProvider. However, + /// ITextProvider does not support setting the value of a control. + /// + /// + /// IValueProvider does not support the retrieval of formatting information or substring values. Implement ITextProvider in these scenarios. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ivalueprovider-get_value HRESULT + // get_Value( BSTR *pRetVal ); + string Value { [return: MarshalAs(UnmanagedType.BStr)] get; } + + /// + /// Indicates whether the value of a control is read-only. + /// This property is read-only. + /// + /// + /// + /// A control should have its IsEnabled property (UIA_IsEnabledPropertyId) set to TRUE and its + /// IValueProvider::IsReadOnly property set to FALSE before allowing a call to IValueProvider::SetValue. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ivalueprovider-get_isreadonly HRESULT + // get_IsReadOnly( BOOL *pRetVal ); + bool IsReadOnly { get; } + } + + /// + /// Provides access to virtualized items, which are items that are represented by placeholder automation elements in the Microsoft UI + /// Automation tree. + /// + /// + /// A virtualized item is typically an item in a virtual list; that is, a list that does not manage its own data. When an application + /// retrieves an IUIAutomationElement for a virtualized item by using FindItemByProperty, UI Automation calls the provider's + /// implementation of FindItemByProperty, where the provider may return a placeholder element that also implements + /// IVirtualizedItemProvider. On a call to Realize, the provider's implementation of Realize returns a full UI Automation element + /// reference and may also scroll the item into view. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-ivirtualizeditemprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IVirtualizedItemProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("cb98b665-2d35-4fac-ad35-f3c60d0c0b8b")] + public interface IVirtualizedItemProvider + { + /// Makes the virtual item fully accessible as a UI Automation element. + /// + /// When an item is obtained from a virtual list, it is only a placeholder. Use this method to convert it to a full reference to UI + /// Automation element. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-ivirtualizeditemprovider-realize HRESULT Realize(); + void Realize(); + } + + /// Provides access to the fundamental window-based functionality of a control. + /// Implemented on a Microsoft UI Automation provider that must support the Window Control Pattern control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iwindowprovider + [PInvokeData("uiautomationcore.h", MSDNShortId = "NN:uiautomationcore.IWindowProvider")] + [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("987df77b-db06-4d77-8f8a-86a9c3bb90b9")] + public interface IWindowProvider + { + /// Changes the visual state of the window. For example, minimizes or maximizes it. + /// + /// Type: WindowVisualState + /// The state of the window. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-setvisualstate HRESULT + // SetVisualState( [in] WindowVisualState state ); + void SetVisualState(WindowVisualState state); + + /// Attempts to close the window. + /// + /// IWindowProvider::Close must return immediately without blocking. + /// + /// IWindowProvider::Close raises the UIA_Window_WindowClosedEventId event. If possible, the event should be raised after the + /// control has completed its associated action. + /// + /// When called on a split pane control, this method will close the pane and remove the associated split. + /// This method may also close all other panes depending on implementation. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-close HRESULT Close(); + void Close(); + + /// + /// Causes the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first. + /// + /// + /// Type: int + /// The amount of time, in milliseconds, to wait for the associated process to become idle. The maximum is Int32.MaxValue. + /// + /// + /// Type: BOOL* + /// + /// Receives TRUE if the window has entered the idle state; FALSE if the time-out occurred. This parameter is passed uninitialized. + /// + /// + /// + /// This method is typically used in conjunction with the handling of a UIA_Window_WindowOpenedEventId. The implementation is + /// dependent on the underlying application framework; therefore this method might return some time after the window is ready for + /// user input. The calling code should not rely on this method to ascertain exactly when the window has become idle. Use the value + /// of pRetVal to determine if the window is ready for input or if the method timed out. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-waitforinputidle HRESULT + // WaitForInputIdle( [in] int milliseconds, [out, retval] BOOL *pRetVal ); + bool WaitForInputIdle(int milliseconds); + + /// + /// Indicates whether the window can be maximized. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-get_canmaximize HRESULT + // get_CanMaximize( BOOL *pRetVal ); + bool CanMaximize { get; } + + /// + /// Indicates whether the window can be minimized. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-get_canminimize HRESULT + // get_CanMinimize( BOOL *pRetVal ); + bool CanMinimize { get; } + + /// + /// Indicates whether the window is modal. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-get_ismodal HRESULT + // get_IsModal( BOOL *pRetVal ); + bool IsModal { get; } + + /// + /// Specifies the visual state of the window; that is, whether the window is normal (restored), minimized, or maximized. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-get_windowvisualstate + // HRESULT get_WindowVisualState( WindowVisualState *pRetVal ); + WindowVisualState WindowVisualState { get; } + + /// + /// Specifies the current state of the window for the purposes of user interaction. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-get_windowinteractionstate + // HRESULT get_WindowInteractionState( WindowInteractionState *pRetVal ); + WindowInteractionState WindowInteractionState { get; } + + /// + /// Indicates whether the window is the topmost element in the z-order. + /// This property is read-only. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-iwindowprovider-get_istopmost HRESULT + // get_IsTopmost( BOOL *pRetVal ); + bool IsTopmost { get; } + } + + /// Contains the coordinates of a point. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiapoint struct UiaPoint { double x; double + // y; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UiaPoint")] + [StructLayout(LayoutKind.Sequential)] + public struct UiaPoint + { + /// + /// Type: double + /// The horizontal screen coordinate. + /// + public double x; + + /// + /// Type: double + /// The vertical screen coordinate. + /// + public double y; + } + + /// Contains the position and size of a rectangle, in screen coordinates. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiarect struct UiaRect { double left; double + // top; double width; double height; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UiaRect")] + [StructLayout(LayoutKind.Sequential)] + public struct UiaRect + { + /// + /// Type: double + /// Position of the left side. + /// + public double left; + + /// + /// Type: double + /// Position of the top side. + /// + public double top; + + /// + /// Type: double + /// Width. + /// + public double width; + + /// + /// Type: double + /// Height. + /// + public double height; + } + + /// Contains information about a custom event. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiautomationeventinfo struct + // UIAutomationEventInfo { GUID guid; LPCWSTR pProgrammaticName; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UIAutomationEventInfo")] + [StructLayout(LayoutKind.Sequential)] + public struct UIAutomationEventInfo + { + /// + /// Type: GUID + /// The event identifier. + /// + public Guid guid; + + /// + /// Type: LPCWSTR + /// The programmatic name of the event (a non-localizable string). + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pProgrammaticName; + } + + /// Contains information about a method that is supported by a custom control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiautomationmethodinfo struct + // UIAutomationMethodInfo { LPCWSTR pProgrammaticName; BOOL doSetFocus; UINT cInParameters; UINT cOutParameters; UIAutomationType + // *pParameterTypes; LPCWSTR *pParameterNames; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UIAutomationMethodInfo")] + [StructLayout(LayoutKind.Sequential)] + public struct UIAutomationMethodInfo + { + /// + /// Type: LPCWSTR + /// The name of the method (a non-localizable string). + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pProgrammaticName; + + /// + /// Type: BOOL + /// TRUE if UI Automation should set the focus on the object before calling the method; otherwise FALSE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool doSetFocus; + + /// + /// Type: UINT + /// The count of [in] parameters, which are always first in the pParameterTypes array. + /// + public uint cInParameters; + + /// + /// Type: UINT + /// The count of [out] parameters, which always follow the [in] parameters in the pParameterTypes array. + /// + public uint cOutParameters; + + /// + /// Type: UIAutomationType* + /// + /// A pointer to an array of values indicating the data types of the parameters of the method. The data types of the In parameters + /// should be first, followed by those of the Out parameters. + /// + /// + [MarshalAs(UnmanagedType.IUnknown)] + public UIAutomationType pParameterTypes; + + /// + /// Type: LPCWSTR* + /// A pointer to an array containing the parameter names (non-localizable strings). + /// + public IntPtr pParameterNames; + } + + /// Contains information about a parameter of a custom control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiautomationparameter struct + // UIAutomationParameter { UIAutomationType type; void *pData; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UIAutomationParameter")] + [StructLayout(LayoutKind.Sequential)] + public struct UIAutomationParameter + { + /// + /// Type: UIAutomationType + /// A value indicating the type of the parameter. + /// + public UIAutomationType type; + + /// + /// Type: void* + /// A pointer to the parameter data. + /// + public IntPtr pData; + } + + /// Contains information about a custom control pattern. + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiautomationpatterninfo struct + // UIAutomationPatternInfo { GUID guid; LPCWSTR pProgrammaticName; GUID providerInterfaceId; GUID clientInterfaceId; UINT cProperties; + // struct UIAutomationPropertyInfo *pProperties; UINT cMethods; struct UIAutomationMethodInfo *pMethods; UINT cEvents; struct + // UIAutomationEventInfo *pEvents; IUIAutomationPatternHandler *pPatternHandler; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UIAutomationPatternInfo")] + [StructLayout(LayoutKind.Sequential)] + public struct UIAutomationPatternInfo + { + /// + /// Type: GUID + /// The unique identifier of the control pattern. + /// + public Guid guid; + + /// + /// Type: LPCWSTR + /// The name of the control pattern (a non-localizable string). + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pProgrammaticName; + + /// + /// Type: GUID + /// The unique identifier of the provider interface for the control pattern. + /// + public Guid providerInterfaceId; + + /// + /// Type: GUID + /// The unique identifier of the client interface for the control pattern. + /// + public Guid clientInterfaceId; + + /// + /// Type: UINT + /// The count of elements in pProperties. + /// + public uint cProperties; + + /// + /// Type: UIAutomationPropertyInfo* + /// A pointer to an array of structures describing properties available on the control pattern. + /// + public IntPtr pProperties; + + /// + /// Type: UINT + /// The count of elements in pMethods. + /// + public uint cMethods; + + /// + /// Type: UIAutomationMethodInfo* + /// A pointer to an array of structures describing methods available on the control pattern. + /// + public IntPtr pMethods; + + /// + /// Type: UINT + /// The count of elements in pEvents. + /// + public uint cEvents; + + /// + /// Type: UIAutomationEventInfo* + /// A pointer to an array of structures describing events available on the control pattern. + /// + public IntPtr pEvents; + + /// + /// Type: IUIAutomationPatternHandler* + /// A pointer to the object that makes the control pattern available to clients. + /// + [MarshalAs(UnmanagedType.IUnknown)] + public IUIAutomationPatternHandler pPatternHandler; + } + + /// Contains information about a custom property. + /// + /// + /// A custom property must have one of the following data types specified by the UIAutomationType enumeration. No other data types are + /// supported for custom properties. For more information, see Custom Properties, Events, and Control Patterns. + /// + /// + /// + /// UIAutomationType_Bool + /// + /// + /// UIAutomationType_Double + /// + /// + /// UIAutomationType_Element + /// + /// + /// UIAutomationType_Int + /// + /// + /// UIAutomationType_Point + /// + /// + /// UIAutomationType_String + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiautomationpropertyinfo struct + // UIAutomationPropertyInfo { GUID guid; LPCWSTR pProgrammaticName; UIAutomationType type; }; + [PInvokeData("uiautomationcore.h", MSDNShortId = "NS:uiautomationcore.UIAutomationPropertyInfo")] + [StructLayout(LayoutKind.Sequential)] + public struct UIAutomationPropertyInfo + { + /// + /// Type: GUID + /// The unique identifier of the property. + /// + public Guid guid; + + /// + /// Type: LPCWSTR + /// The programmatic name of the property (a non-localizable string). + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pProgrammaticName; + + /// + /// Type: UIAutomationType + /// A value from the UIAutomationType enumerated type indicating the data type of the property value. + /// + public UIAutomationType type; + } + + /// Implements the IUIAutomationRegistrar interface. + // https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ff384837(v=vs.85) + [ComImport, ClassInterface(ClassInterfaceType.None), Guid("8609c4ec-4a1a-4d88-a357-5a66e060e1cf")] + public class CUIAutomationRegistrar + { + } +} \ No newline at end of file diff --git a/PInvoke/UIAutomation/Vanara.PInvoke.UIAutomation.csproj b/PInvoke/UIAutomation/Vanara.PInvoke.UIAutomation.csproj new file mode 100644 index 00000000..412d6b6e --- /dev/null +++ b/PInvoke/UIAutomation/Vanara.PInvoke.UIAutomation.csproj @@ -0,0 +1,22 @@ + + + + uiautomationcore.dll + + + PInvoke API (methods, structures and constants) imported from Windows UIAutomationCore.dll. + Vanara.PInvoke.UIAutomation + $(AssemblyName) + $(AssemblyName) + pinvoke;vanara;net-extensions;interop;UIAutomation;UIAutomationCore + + + + + + + + + + + \ No newline at end of file diff --git a/PInvoke/User32/VisibleWindow.cs b/PInvoke/User32/VisibleWindow.cs index fcea6203..69021b56 100644 --- a/PInvoke/User32/VisibleWindow.cs +++ b/PInvoke/User32/VisibleWindow.cs @@ -536,6 +536,9 @@ public class VisibleWindow : WindowBase return screenRect; } + /// Closes the window and destroys the handle. + public virtual void Close() => Dispose(); + /// Sets input focus to the window. public void Focus() => Win32Error.ThrowLastErrorIf(SetFocus(Handle), h => h.IsNull); diff --git a/PInvoke/User32/WinUser.Edit.cs b/PInvoke/User32/WinUser.Edit.cs index f2a086ac..5165bd24 100644 --- a/PInvoke/User32/WinUser.Edit.cs +++ b/PInvoke/User32/WinUser.Edit.cs @@ -7,10 +7,17 @@ namespace Vanara.PInvoke; public static partial class User32 { private const int ECM_FIRST = 0x1500; + private const int EN_FIRST = -1520; /// - /// An application-defined callback function used with the EM_SETWORDBREAKPROC message. A multiline edit control or a rich edit control calls an EditWordBreakProc function to break a line of text. - /// The EDITWORDBREAKPROC type defines a pointer to this callback function. EditWordBreakProc is a placeholder for the application-defined function name. + /// + /// An application-defined callback function used with the EM_SETWORDBREAKPROC message. A multiline edit control or a rich edit control + /// calls an EditWordBreakProc function to break a line of text. + /// + /// + /// The EDITWORDBREAKPROC type defines a pointer to this callback function. EditWordBreakProc is a placeholder for the + /// application-defined function name. + /// /// /// /// Type: LPTSTR @@ -18,11 +25,17 @@ public static partial class User32 /// /// /// Type: int - /// An index to a character position in the buffer of text that identifies the point at which the function should begin checking for a word break. + /// + /// An index to a character position in the buffer of text that identifies the point at which the function should begin checking for a + /// word break. + /// /// /// /// Type: int - /// The number of TCHARs in the edit control text. For the ANSI text, this is the number of bytes; for the Unicode text, this is the number of WCHARs. + /// + /// The number of TCHARs in the edit control text. For the ANSI text, this is the number of bytes; for the Unicode text, this is + /// the number of WCHARs. + /// /// /// /// Type: int @@ -34,7 +47,9 @@ public static partial class User32 /// /// /// WB_CLASSIFY - /// Retrieves the character class and word break flags of the character at the specified position. This value is for use with rich edit controls. + /// + /// Retrieves the character class and word break flags of the character at the specified position. This value is for use with rich edit controls. + /// /// /// /// WB_ISDELIMITER @@ -50,11 +65,17 @@ public static partial class User32 /// /// /// WB_MOVEWORDLEFT - /// Finds the beginning of a word to the left of the specified position. This value is used during CTRL+LEFT key processing. This value is for use with rich edit controls. + /// + /// Finds the beginning of a word to the left of the specified position. This value is used during CTRL+LEFT key processing. This value + /// is for use with rich edit controls. + /// /// /// /// WB_MOVEWORDRIGHT - /// Finds the beginning of a word to the right of the specified position. This value is used during CTRL+RIGHT key processing. This value is for use with rich edit controls. + /// + /// Finds the beginning of a word to the right of the specified position. This value is used during CTRL+RIGHT key processing. This value + /// is for use with rich edit controls. + /// /// /// /// WB_RIGHT @@ -62,216 +83,327 @@ public static partial class User32 /// /// /// WB_RIGHTBREAK - /// Finds the end-of-word delimiter to the right of the specified position. This is useful in right-aligned edit controls. This value is for use with rich edit controls. + /// + /// Finds the end-of-word delimiter to the right of the specified position. This is useful in right-aligned edit controls. This value is + /// for use with rich edit controls. + /// /// /// /// /// /// Type: int - /// If the code parameter specifies WB_ISDELIMITER, the return value is nonzero (TRUE) if the character at the specified position is a delimiter, or zero if it is not. If the code parameter specifies WB_CLASSIFY, the return value is the character class and word break flags of the character at the specified position. Otherwise, the return value is an index to the beginning of a word in the buffer of text. + /// + /// If the code parameter specifies WB_ISDELIMITER, the return value is nonzero (TRUE) if the character at the specified + /// position is a delimiter, or zero if it is not. If the code parameter specifies WB_CLASSIFY, the return value is the + /// character class and word break flags of the character at the specified position. Otherwise, the return value is an index to the + /// beginning of a word in the buffer of text. + /// /// /// - /// A carriage return followed by a line feed must be treated as a single word by the callback function. Two carriage returns followed by a line feed also must be treated as a single word. - /// An application must install the callback function by specifying the address of the callback function in an EM_SETWORDBREAKPROC message. - /// Rich Edit 1.0:Microsoft Rich Edit 1.0 only passes back ANSI characters to EditWordBreakProc. For rich edit controls, you can alternately use the EM_SETWORDBREAKPROCEX message to replace the default extended word break procedure with an EditWordBreakProcEx callback function. This function provides additional information about the text, such as the character set. - /// Rich Edit 2.0 and later:Microsoft Rich Edit 2.0 and later only pass back Unicode characters to EditWordBreakProc. Thus, an ANSI application would convert the Rich Edit-supplied Unicode string using WideCharToMultiByte, and then translate the indices appropriately. - /// Note The winuser.h header defines EDITWORDBREAKPROC 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. + /// + /// A carriage return followed by a line feed must be treated as a single word by the callback function. Two carriage returns followed by + /// a line feed also must be treated as a single word. + /// + /// + /// An application must install the callback function by specifying the address of the callback function in an EM_SETWORDBREAKPROC message. + /// + /// + /// Rich Edit 1.0: Microsoft Rich Edit 1.0 only passes back ANSI characters to EditWordBreakProc. For rich edit controls, + /// you can alternately use the EM_SETWORDBREAKPROCEX message to replace the default extended word break procedure with an + /// EditWordBreakProcEx callback function. This function provides additional information about the text, such as the character set. + /// + /// + /// Rich Edit 2.0 and later: Microsoft Rich Edit 2.0 and later only pass back Unicode characters to EditWordBreakProc. + /// Thus, an ANSI application would convert the Rich Edit-supplied Unicode string using WideCharToMultiByte, and then translate the + /// indices appropriately. + /// + /// + /// Note + /// + /// The winuser.h header defines EDITWORDBREAKPROC 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. + /// + /// /// - // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-editwordbreakproca - // EDITWORDBREAKPROCA Editwordbreakproca; int Editwordbreakproca( [in] LPSTR lpch, [in] int ichCurrent, [in] int cch, [in] int code ) {...} + // https://learn.microsoft.com/en-us/windows/win32/api/winuser/nc-winuser-editwordbreakproca EDITWORDBREAKPROCA Editwordbreakproca; int + // Editwordbreakproca( [in] LPSTR lpch, [in] int ichCurrent, [in] int cch, [in] int code ) {...} [PInvokeData("winuser.h", MSDNShortId = "NC:winuser.EDITWORDBREAKPROCA")] [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = false, CharSet = CharSet.Auto)] public delegate int EDITWORDBREAKPROC([MarshalAs(UnmanagedType.LPTStr)] string lpch, int ichCurrent, int cch, WB code); - /// Word-break constants. - [PInvokeData("winuser.h", MSDNShortId = "NC:winuser.EDITWORDBREAKPROCA")] - public enum WB + /// The margins to set. + [PInvokeData("WinUser.h")] + [Flags] + public enum EC : ushort { - /// Retrieves the character class and word break flags of the character at the specified position. This value is for use with rich edit controls. - WB_CLASSIFY = 3, - /// Checks whether the character at the specified position is a delimiter. - WB_ISDELIMITER = 2, - /// Finds the beginning of a word to the left of the specified position. - WB_LEFT = 0, - /// Finds the end-of-word delimiter to the left of the specified position. This value is for use with rich edit controls. - WB_LEFTBREAK = 6, - /// Finds the beginning of a word to the left of the specified position. This value is used during CTRL+LEFT key processing. This value is for use with rich edit controls. - WB_MOVEWORDLEFT = 4, - /// Finds the beginning of a word to the right of the specified position. This value is used during CTRL+RIGHT key processing. This value is for use with rich edit controls. - WB_MOVEWORDRIGHT = 5, - /// Finds the beginning of a word to the right of the specified position. This is useful in right-aligned edit controls. - WB_RIGHT = 1, - /// Finds the end-of-word delimiter to the right of the specified position. This is useful in right-aligned edit controls. This value is for use with rich edit controls. - WB_RIGHTBREAK = 7, + /// Sets the left margin. + EC_LEFTMARGIN = 0x0001, + + /// Sets the right margin. + EC_RIGHTMARGIN = 0x0002, + + /// + /// Rich edit controls: Sets the left and right margins to a narrow width calculated using the text metrics of the control's current + /// font. If no font has been set for the control, the margins are set to zero. The lParam parameter is ignored. + /// Edit controls: The EC_USEFONTINFO value cannot be used in the wParam parameter. It can only be used in the lParam parameter. + /// + EC_USEFONTINFO = 0xffff, } - /// Styles for the edit control. - [PInvokeData("Winuser.h", MSDNShortId = "edit_control_constants")] - [Flags] - public enum EditStyle : uint + /// Indicates the end of line character used by an edit control. + // https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ne-commctrl-ec_endofline typedef enum EC_ENDOFLINE { + // EC_ENDOFLINE_DETECTFROMCONTENT = 0, EC_ENDOFLINE_CRLF = 1, EC_ENDOFLINE_CR = 2, EC_ENDOFLINE_LF = 3 } ; + [PInvokeData("commctrl.h", MSDNShortId = "NE:commctrl.EC_ENDOFLINE")] + public enum EC_ENDOFLINE { - /// Left aligns text. - ES_LEFT = 0x0000, - /// Centers text in a single-line or multiline edit control. - ES_CENTER = 0x0001, - /// Right aligns text in a single-line or multiline edit control. - ES_RIGHT = 0x0002, /// - /// Designates a multiline edit control. The default is single-line edit control. - /// When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style. - /// When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If you do not specify ES_AUTOVSCROLL, the edit control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed. - /// If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping position changes and the text is redisplayed. - /// Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the parent window. + /// Value: + /// 0 + /// End of line character specified in content. /// - ES_MULTILINE = 0x0004, - /// Converts all characters to uppercase as they are typed into the edit control. To change this style after the control has been created, use SetWindowLong. - ES_UPPERCASE = 0x0008, - /// Converts all characters to lowercase as they are typed into the edit control. To change this style after the control has been created, use SetWindowLong. - ES_LOWERCASE = 0x0010, - /// Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls. - ES_PASSWORD = 0x0020, - /// Automatically scrolls text up one page when the user presses the ENTER key on the last line. - ES_AUTOVSCROLL = 0x0040, - /// Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero. - ES_AUTOHSCROLL = 0x0080, - /// Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, even if the control does not have the focus. - ES_NOHIDESEL = 0x0100, - /// Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain file names that will be used on file systems that do not support Unicode. - /// To change this style after the control has been created, use SetWindowLong. - ES_OEMCONVERT = 0x0400, - /// Prevents the user from typing or editing text in the edit control. - ES_READONLY = 0x0800, - /// Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control. - ES_WANTRETURN = 0x1000, - /// Allows only digits to be entered into the edit control. - ES_NUMBER = 0x2000, + EC_ENDOFLINE_DETECTFROMCONTENT = 0, + + /// + /// Value: + /// 1 + /// End of line character is CRLF. + /// + EC_ENDOFLINE_CRLF, + + /// + /// Value: + /// 2 + /// End of line character is CR. + /// + EC_ENDOFLINE_CR, + + /// + /// Value: + /// 3 + /// End of line character is LF. + /// + EC_ENDOFLINE_LF, + } + + /// Defines constants that indicate the entry point of a web search. + // https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ne-commctrl-ec_searchweb_entrypoint typedef enum EC_SEARCHWEB_ENTRYPOINT + // { EC_SEARCHWEB_ENTRYPOINT_EXTERNAL, EC_SEARCHWEB_ENTRYPOINT_CONTEXTMENU } ; + [PInvokeData("commctrl.h", MSDNShortId = "NE:commctrl.EC_SEARCHWEB_ENTRYPOINT")] + public enum EC_SEARCHWEB_ENTRYPOINT + { + /// Entry point is external. + EC_SEARCHWEB_ENTRYPOINT_EXTERNAL = 0, + + /// Entry point is a context menu. + EC_SEARCHWEB_ENTRYPOINT_CONTEXTMENU, } /// Window messages for the edit control. [PInvokeData("Winuser.h", MSDNShortId = "edit_control_constants")] public enum EditMessage { - /// Gets the starting and ending character positions (in TCHARs) of the current selection in an edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the starting and ending character positions (in TCHAR s) of the current selection in an edit control. You can send + /// this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// A pointer to a DWORD value that receives the starting position of the selection. This parameter can be NULL. /// lParam - /// A pointer to a DWORD value that receives the position of the first unselected character after the end of the selection. This parameter can be NULL. /// - /// Returns + /// A pointer to a DWORD value that receives the position of the first unselected character after the end of the selection. + /// This parameter can be NULL. + /// + /// Returns + /// + /// The return value is a zero-based value with the starting position of the selection in the LOWORD and the position of the + /// first TCHAR after the last selected TCHAR in the HIWORD. If either of these values exceeds 65,535, the + /// return value is -1. /// - /// The return value is a zero-based value with the starting position of the selection in the LOWORD and the position of the first TCHAR after the last selected TCHAR in the HIWORD. If either of these values exceeds 65,535, the return value is -1. /// It is better to use the values returned in wParam and lParam because they are full 32-bit values. /// /// If there is no selection, the starting and ending values are both the position of the caret. - /// Rich edit controls: You can also use the EM_EXGETSEL message to retrieve the same information. EM_EXGETSEL also returns starting and ending character positions as 32-bit values. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich edit controls: You can also use the EM_EXGETSEL message to retrieve the same information. EM_EXGETSEL + /// also returns starting and ending character positions as 32-bit values. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getsel [MsgParams(typeof(uint?), typeof(uint?), LResultType = typeof(uint))] EM_GETSEL = 0x00B0, - /// Selects a range of characters in an edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Selects a range of characters in an edit control. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// The starting character position of the selection. /// lParam /// The ending character position of the selection. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// - /// The start value can be greater than the end value. The lower of the two values specifies the character position of the first character in the selection. The higher value specifies the position of the first character beyond the selection. - /// The start value is the anchor point of the selection, and the end value is the active end. If the user uses the SHIFT key to adjust the size of the selection, the active end can move but the anchor point remains the same. - /// If the start is 0 and the end is -1, all the text in the edit control is selected. If the start is -1, any current selection is deselected. - /// Edit controls: The control displays a flashing caret at the end position regardless of the relative values of start and end. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. - /// If the edit control has the ES_NOHIDESEL style, the selected text is highlighted regardless of whether the control has focus. Without the ES_NOHIDESEL style, the selected text is highlighted only when the edit control has the focus. + /// + /// The start value can be greater than the end value. The lower of the two values specifies the character position of the first + /// character in the selection. The higher value specifies the position of the first character beyond the selection. + /// + /// + /// The start value is the anchor point of the selection, and the end value is the active end. If the user uses the SHIFT key to + /// adjust the size of the selection, the active end can move but the anchor point remains the same. + /// + /// + /// If the start is 0 and the end is -1, all the text in the edit control is selected. If the start is -1, any current selection is deselected. + /// + /// + /// Edit controls: The control displays a flashing caret at the end position regardless of the relative values of start and end. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + /// If the edit control has the ES_NOHIDESEL style, the selected text is highlighted regardless of whether the control has + /// focus. Without the ES_NOHIDESEL style, the selected text is highlighted only when the edit control has the focus. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setsel [MsgParams(typeof(int), typeof(int), LResultType = null)] EM_SETSEL = 0x00B1, - /// Gets the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent of the size of the edit-control window. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle into which the control draws + /// the text. The limiting rectangle is independent of the size of the edit-control window. You can send this message to either an + /// edit control or a rich edit control. + /// + /// Parameters /// wParam /// This parameter is not used. /// lParam /// A pointer to a RECT structure that receives the formatting rectangle. - /// - /// Returns - /// + /// Returns /// The return value is not meaningful. /// - /// You can modify the formatting rectangle of a multiline edit control by using the EM_SETRECT and EM_SETRECTNP messages. - /// Under certain conditions, EM_GETRECT might not return the exact values that EM_SETRECT or EM_SETRECTNP set it will be approximately correct, but it can be off by a few pixels. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. The formatting rectangle does not include the selection bar, which is an unmarked area to the left of each paragraph. When clicked, the selection bar selects the line. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// You can modify the formatting rectangle of a multiline edit control by using the EM_SETRECT and EM_SETRECTNP messages. + /// + /// + /// Under certain conditions, EM_GETRECT might not return the exact values that EM_SETRECT or EM_SETRECTNP set + /// it will be approximately correct, but it can be off by a few pixels. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. The formatting rectangle does not include the selection bar, + /// which is an unmarked area to the left of each paragraph. When clicked, the selection bar selects the line. For information about + /// the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getrect [MsgParams(null, typeof(RECT?), LResultType = null)] EM_GETRECT = 0x00B2, /// - /// Sets the formatting rectangle of a multiline edit control. The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent of the size of the edit control window. - /// This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. - /// /// - /// Parameters + /// Sets the formatting rectangle of a multiline edit control. The formatting rectangle is the limiting rectangle into which the + /// control draws the text. The limiting rectangle is independent of the size of the edit control window. /// + /// + /// This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. + /// + /// + /// Parameters /// wParam - /// Rich Edit 2.0 and later: Indicates whether lParam specifies absolute or relative coordinates. A value of zero indicates absolute coordinates. A value of 1 indicates offsets relative to the current formatting rectangle. (The offsets can be positive or negative.) + /// + /// Rich Edit 2.0 and later: Indicates whether lParam specifies absolute or relative coordinates. A value of zero indicates + /// absolute coordinates. A value of 1 indicates offsets relative to the current formatting rectangle. (The offsets can be positive + /// or negative.) + /// /// Edit controls and Rich Edit 1.0: This parameter is not used and must be zero. /// lParam - /// A pointer to a RECT structure that specifies the new dimensions of the rectangle. If this parameter is NULL, the formatting rectangle is set to its default values. /// - /// Returns + /// A pointer to a RECT structure that specifies the new dimensions of the rectangle. If this parameter is NULL, the + /// formatting rectangle is set to its default values. /// + /// Returns /// This message does not return a value. /// - /// Setting lParam to NULL has no effect if a touch device is installed, or if EM_SETRECT is sent from a thread that has a hook installed (see SetWindowsHookEx). In these cases, lParam should contain a valid pointer to a RECT structure. - /// The EM_SETRECT message causes the text of the edit control to be redrawn. To change the size of the formatting rectangle without redrawing the text, use the EM_SETRECTNP message. - /// When an edit control is first created, the formatting rectangle is set to a default size. You can use the EM_SETRECT message to make the formatting rectangle larger or smaller than the edit control window. - /// If the edit control does not have a horizontal scroll bar, and the formatting rectangle is set to be larger than the edit control window, lines of text exceeding the width of the edit control window (but smaller than the width of the formatting rectangle) are clipped instead of wrapped. - /// If the edit control contains a border, the formatting rectangle is reduced by the size of the border. If you are adjusting the rectangle returned by an EM_GETRECT message, you must remove the size of the border before using the rectangle with the EM_SETRECT message. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. The formatting rectangle does not include the selection bar, which is an unmarked area to the left of each paragraph. When the user clicks in the selection bar, the corresponding line is selected. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Setting lParam to NULL has no effect if a touch device is installed, or if EM_SETRECT is sent from a thread that + /// has a hook installed (see SetWindowsHookEx). In these cases, lParam should contain a valid pointer to a RECT structure. + /// + /// + /// The EM_SETRECT message causes the text of the edit control to be redrawn. To change the size of the formatting rectangle + /// without redrawing the text, use the EM_SETRECTNP message. + /// + /// + /// When an edit control is first created, the formatting rectangle is set to a default size. You can use the EM_SETRECT + /// message to make the formatting rectangle larger or smaller than the edit control window. + /// + /// + /// If the edit control does not have a horizontal scroll bar, and the formatting rectangle is set to be larger than the edit control + /// window, lines of text exceeding the width of the edit control window (but smaller than the width of the formatting rectangle) are + /// clipped instead of wrapped. + /// + /// + /// If the edit control contains a border, the formatting rectangle is reduced by the size of the border. If you are adjusting the + /// rectangle returned by an EM_GETRECT message, you must remove the size of the border before using the rectangle with the + /// EM_SETRECT message. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. The formatting rectangle does not include the selection bar, + /// which is an unmarked area to the left of each paragraph. When the user clicks in the selection bar, the corresponding line is + /// selected. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setrect [MsgParams(typeof(BOOL), typeof(RECT?), LResultType = null)] EM_SETRECT = 0x00B3, /// - /// Sets the formatting rectangle of a multiline edit control. The EM_SETRECTNP message is identical to the EM_SETRECT message, except that EM_SETRECTNP does not redraw the edit control window. - /// The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent of the size of the edit control window. - /// This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. - /// /// - /// Parameters + /// Sets the formatting rectangle of a multiline edit control. The EM_SETRECTNP message is identical to the EM_SETRECT + /// message, except that EM_SETRECTNP does not redraw the edit control window. /// + /// + /// The formatting rectangle is the limiting rectangle into which the control draws the text. The limiting rectangle is independent + /// of the size of the edit control window. + /// + /// + /// This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. + /// + /// + /// Parameters /// wParam - /// Rich Edit 3.0 and later: Indicates whether the new rectangle contains absolute or relative coordinates. A value of zero indicates absolute coordinates. A value of 1 indicates offsets relative to the current formatting rectangle. (The offsets can be positive or negative.) + /// + /// Rich Edit 3.0 and later: Indicates whether the new rectangle contains absolute or relative coordinates. A value of zero + /// indicates absolute coordinates. A value of 1 indicates offsets relative to the current formatting rectangle. (The offsets can be + /// positive or negative.) + /// /// Edit controls: This parameter is not used and must be zero. /// lParam - /// A pointer to a RECT structure that specifies the new dimensions of the rectangle. If this parameter is NULL, the formatting rectangle is set to its default values. /// - /// Returns + /// A pointer to a RECT structure that specifies the new dimensions of the rectangle. If this parameter is NULL, the + /// formatting rectangle is set to its default values. /// + /// Returns /// This message does not return a value. - /// Rich Edit: Supported in Microsoft Rich Edit 3.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 3.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setrectnp [MsgParams(typeof(BOOL), typeof(RECT?), LResultType = null)] EM_SETRECTNP = 0x00B4, - /// Scrolls the text vertically in a multiline edit control. This message is equivalent to sending a WM_VSCROLL message to the edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Scrolls the text vertically in a multiline edit control. This message is equivalent to sending a WM_VSCROLL message to the + /// edit control. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// The action the scroll bar is to take. This parameter can be one of the following values. /// @@ -298,544 +430,2191 @@ public static partial class User32 /// /// lParam /// This parameter is not used. + /// Returns /// - /// Returns + /// If the message is successful, the HIWORD of the return value is TRUE, and the LOWORD is the number of lines + /// that the command scrolls. The number returned may not be the same as the actual number of lines scrolled if the scrolling moves + /// to the beginning or the end of the text. If the wParam parameter specifies an invalid value, the return value is FALSE. /// - /// If the message is successful, the HIWORD of the return value is TRUE, and the LOWORD is the number of lines that the command scrolls. The number returned may not be the same as the actual number of lines scrolled if the scrolling moves to the beginning or the end of the text. If the wParam parameter specifies an invalid value, the return value is FALSE. /// - /// To scroll to a specific line or character position, use the EM_LINESCROLL message. To scroll the caret into view, use the EM_SCROLLCARET message. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// To scroll to a specific line or character position, use the EM_LINESCROLL message. To scroll the caret into view, use the + /// EM_SCROLLCARET message. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-scroll [MsgParams(typeof(SBCMD), null, LResultType = typeof(uint))] EM_SCROLL = 0x00B5, /// Scrolls the text in a multiline edit control. - /// - /// Parameters - /// + /// Parameters /// wParam /// Edit controls: The number of characters to scroll horizontally. /// Rich edit controls: This parameter is not used; it must be zero. /// lParam /// The number of lines to scroll vertically. - /// - /// Returns - /// + /// Returns /// If the message is sent to a multiline edit control, the return value is TRUE. /// If the message is sent to a single-line edit control, the return value is FALSE. /// - /// The control does not scroll vertically past the last line of text in the edit control. If the current line plus the number of lines specified by the lParam parameter exceeds the total number of lines in the edit control, the value is adjusted so that the last line of the edit control is scrolled to the top of the edit-control window. - /// Edit controls: The EM_LINESCROLL message scrolls the text vertically or horizontally in a multiline edit control. The EM_LINESCROLL message can be used to scroll horizontally past the last character of any line. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. The EM_LINESCROLL message scrolls the text vertically in a multiline edit control. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// The control does not scroll vertically past the last line of text in the edit control. If the current line plus the number of + /// lines specified by the lParam parameter exceeds the total number of lines in the edit control, the value is adjusted so that the + /// last line of the edit control is scrolled to the top of the edit-control window. + /// + /// + /// Edit controls: The EM_LINESCROLL message scrolls the text vertically or horizontally in a multiline edit control. + /// The EM_LINESCROLL message can be used to scroll horizontally past the last character of any line. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. The EM_LINESCROLL message scrolls the text vertically in + /// a multiline edit control. For information about the compatibility of rich edit versions with the various system versions, see + /// About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-linescroll [MsgParams(typeof(int), typeof(int), LResultType = typeof(BOOL))] EM_LINESCROLL = 0x00B6, - /// Scrolls the caret into view in an edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Scrolls the caret into view in an edit control. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// This parameter is reserved. It should be set to zero. /// lParam /// This parameter is reserved. It should be set to zero. - /// - /// Returns - /// + /// Returns /// The return value is not meaningful. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-scrollcaret [MsgParams(LResultType = null)] EM_SCROLLCARET = 0x00B7, - /// Gets the state of an edit control's modification flag. The flag indicates whether the contents of the edit control have been modified. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the state of an edit control's modification flag. The flag indicates whether the contents of the edit control have been + /// modified. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. - /// - /// Returns - /// + /// Returns /// If the contents of edit control have been modified, the return value is nonzero; otherwise, it is zero. /// - /// The system automatically clears the modification flag to zero when the control is created. If the user changes the control's text, the system sets the flag to nonzero. You can send the EM_SETMODIFY message to the edit control to set or clear the flag. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// The system automatically clears the modification flag to zero when the control is created. If the user changes the control's + /// text, the system sets the flag to nonzero. You can send the EM_SETMODIFY message to the edit control to set or clear the flag. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getmodify [MsgParams(LResultType = typeof(BOOL))] EM_GETMODIFY = 0x00B8, - /// Sets or clears the modification flag for an edit control. The modification flag indicates whether the text within the edit control has been modified. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Sets or clears the modification flag for an edit control. The modification flag indicates whether the text within the edit + /// control has been modified. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam - /// The new value for the modification flag. A value of TRUE indicates the text has been modified, and a value of FALSE indicates it has not been modified. + /// + /// The new value for the modification flag. A value of TRUE indicates the text has been modified, and a value of FALSE + /// indicates it has not been modified. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// - /// The system automatically clears the modification flag to zero when the control is created. If the user changes the control's text, the system sets the flag to nonzero. You can send the EM_GETMODIFY message to the edit control to retrieve the current state of the flag. - /// Rich Edit 1.0: Objects created without the REO_DYNAMICSIZE flag will lock in their extents when the modify flag is set to FALSE. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// The system automatically clears the modification flag to zero when the control is created. If the user changes the control's + /// text, the system sets the flag to nonzero. You can send the EM_GETMODIFY message to the edit control to retrieve the + /// current state of the flag. + /// + /// + /// Rich Edit 1.0: Objects created without the REO_DYNAMICSIZE flag will lock in their extents when the modify flag is + /// set to FALSE. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setmodify [MsgParams(typeof(BOOL), null, LResultType = null)] EM_SETMODIFY = 0x00B9, - /// Gets the number of lines in a multiline edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the number of lines in a multiline edit control. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. + /// Returns /// - /// Returns + /// The return value is an integer specifying the total number of text lines in the multiline edit control or rich edit control. If + /// the control has no text, the return value is 1. The return value will never be less than 1. /// - /// The return value is an integer specifying the total number of text lines in the multiline edit control or rich edit control. If the control has no text, the return value is 1. The return value will never be less than 1. /// - /// The EM_GETLINECOUNT message retrieves the total number of text lines, not just the number of lines that are currently visible. + /// + /// The EM_GETLINECOUNT message retrieves the total number of text lines, not just the number of lines that are currently visible. + /// /// If the Wordwrap feature is enabled, the number of lines can change when the dimensions of the editing window change. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getlinecount [MsgParams(LResultType = typeof(int))] EM_GETLINECOUNT = 0x00BA, - /// Gets the character index of the first character of a specified line in a multiline edit control. A character index is the zero-based index of the character from the beginning of the edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the character index of the first character of a specified line in a multiline edit control. A character index is the + /// zero-based index of the character from the beginning of the edit control. You can send this message to either an edit control or + /// a rich edit control. + /// + /// Parameters /// wParam /// The zero-based line number. A value of -1 specifies the current line number (the line that contains the caret). /// lParam /// This parameter is not used. + /// Returns /// - /// Returns + /// The return value is the character index of the line specified in the wParam parameter, or it is -1 if the specified line number + /// is greater than the number of lines in the edit control. /// - /// The return value is the character index of the line specified in the wParam parameter, or it is -1 if the specified line number is greater than the number of lines in the edit control. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-lineindex [MsgParams(typeof(int), null, LResultType = typeof(int))] EM_LINEINDEX = 0x00BB, /// Sets the handle of the memory that will be used by a multiline edit control. - /// - /// Parameters - /// + /// Parameters /// wParam - /// A handle to the memory buffer the edit control uses to store the currently displayed text instead of allocating its own memory. If necessary, the control reallocates this memory. + /// + /// A handle to the memory buffer the edit control uses to store the currently displayed text instead of allocating its own memory. + /// If necessary, the control reallocates this memory. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// - /// Before an application sets a new memory handle, it should send an EM_GETHANDLE message to retrieve the handle of the current memory buffer and should free that memory. - /// An edit control automatically reallocates the given buffer whenever it needs additional space for text, or it removes enough text so that additional space is no longer needed. - /// Sending an EM_SETHANDLE message clears the undo buffer (EM_CANUNDO returns zero) and the internal modification flag (EM_GETMODIFY returns zero). The edit control window is redrawn. - /// Rich Edit: The EM_SETHANDLE message is not supported. Rich edit controls do not store text as a simple array of characters. + /// + /// Before an application sets a new memory handle, it should send an EM_GETHANDLE message to retrieve the handle of the + /// current memory buffer and should free that memory. + /// + /// + /// An edit control automatically reallocates the given buffer whenever it needs additional space for text, or it removes enough text + /// so that additional space is no longer needed. + /// + /// + /// Sending an EM_SETHANDLE message clears the undo buffer ( EM_CANUNDO returns zero) and the internal modification + /// flag ( EM_GETMODIFY returns zero). The edit control window is redrawn. + /// + /// + /// Rich Edit: The EM_SETHANDLE message is not supported. Rich edit controls do not store text as a simple array of characters. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-sethandle [MsgParams(typeof(Kernel32.HLOCAL), null, LResultType = null)] EM_SETHANDLE = 0x00BC, /// Gets a handle of the memory currently allocated for a multiline edit control's text. - /// - /// Parameters - /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. + /// Returns /// - /// Returns + /// The return value is a memory handle identifying the buffer that holds the content of the edit control. If an error occurs, such + /// as sending the message to a single-line edit control, the return value is zero. /// - /// The return value is a memory handle identifying the buffer that holds the content of the edit control. If an error occurs, such as sending the message to a single-line edit control, the return value is zero. /// - /// If the function succeeds, the application can access the contents of the edit control by casting the return value to HLOCAL and passing it to LocalLock. LocalLock returns a pointer to a buffer that is a null-terminated array of CHARs or WCHARs, depending on whether an ANSI or Unicode function created the control. For example, if CreateWindowExA was used the buffer is an array of CHARs, but if CreateWindowExW was used the buffer is an array of WCHARs. The application may not change the contents of the buffer. To unlock the buffer, the application calls LocalUnlock before allowing the edit control to receive new messages. - /// Note For Comctl32.dll version 6, the buffer always contains an array of WCHARs, regardless of whether an ANSI or Unicode function created the edit control. For more information on DLL versions, see Common Control Versions. - /// If your application cannot abide by the restrictions imposed by EM_GETHANDLE, use the GetWindowTextLength and GetWindowText functions to copy the contents of the edit control into an application-provided buffer. - /// Rich Edit: The EM_GETHANDLE message is not supported. Rich edit controls do not store text as a simple array of characters. + /// + /// If the function succeeds, the application can access the contents of the edit control by casting the return value to + /// HLOCAL and passing it to LocalLock. LocalLock returns a pointer to a buffer that is a null-terminated array + /// of CHAR s or WCHAR s, depending on whether an ANSI or Unicode function created the control. For example, if + /// CreateWindowExA was used the buffer is an array of CHAR s, but if CreateWindowExW was used the buffer is an + /// array of WCHAR s. The application may not change the contents of the buffer. To unlock the buffer, the application calls + /// LocalUnlock before allowing the edit control to receive new messages. + /// + /// + /// Note + /// + /// For Comctl32.dll version 6, the buffer always contains an array of WCHAR s, regardless of whether an ANSI or Unicode + /// function created the edit control. For more information on DLL versions, see Common Control Versions. + /// + /// + /// + /// If your application cannot abide by the restrictions imposed by EM_GETHANDLE, use the GetWindowTextLength and + /// GetWindowText functions to copy the contents of the edit control into an application-provided buffer. + /// + /// + /// Rich Edit: The EM_GETHANDLE message is not supported. Rich edit controls do not store text as a simple array of characters. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gethandle [MsgParams(LResultType = typeof(Kernel32.HLOCAL))] EM_GETHANDLE = 0x00BD, - /// Gets the position of the scroll box (thumb) in the vertical scroll bar of a multiline edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the position of the scroll box (thumb) in the vertical scroll bar of a multiline edit control. You can send this message to + /// either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. - /// - /// Returns - /// + /// Returns /// The return value is the position of the scroll box. - /// Rich Edit: Supported in Microsoft Rich Edit 2.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 2.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getthumb [MsgParams(LResultType = typeof(int))] EM_GETTHUMB = 0x00BE, - /// Retrieves the length, in characters, of a line in an edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Retrieves the length, in characters, of a line in an edit control. You can send this message to either an edit control or a rich + /// edit control. + /// + /// Parameters /// wParam - /// The character index of a character in the line whose length is to be retrieved. If this parameter is greater than the number of characters in the control, the return value is zero. - /// This parameter can be -1. In this case, the message returns the number of unselected characters on lines containing selected characters. For example, if the selection extended from the fourth character of one line through the eighth character from the end of the next line, the return value would be 10 (three characters on the first line and seven on the next). + /// + /// The character index of a character in the line whose length is to be retrieved. If this parameter is greater than the number of + /// characters in the control, the return value is zero. + /// + /// + /// This parameter can be -1. In this case, the message returns the number of unselected characters on lines containing selected + /// characters. For example, if the selection extended from the fourth character of one line through the eighth character from the + /// end of the next line, the return value would be 10 (three characters on the first line and seven on the next). + /// /// lParam /// This parameter is not used. + /// Returns /// - /// Returns + /// For multiline edit controls, the return value is the length, in TCHAR s, of the line specified by the wParam parameter. + /// For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. It does not include the + /// carriage-return character at the end of the line. /// - /// For multiline edit controls, the return value is the length, in TCHARs, of the line specified by the wParam parameter. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. It does not include the carriage-return character at the end of the line. - /// For single-line edit controls, the return value is the length, in TCHARs, of the text in the edit control. + /// For single-line edit controls, the return value is the length, in TCHAR s, of the text in the edit control. /// If wParam is greater than the number of characters in the control, the return value is zero. /// /// Use the EM_LINEINDEX message to retrieve a character index for a given line number within a multiline edit control. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-linelength [MsgParams(typeof(int), null, LResultType = typeof(int))] EM_LINELENGTH = 0x00C1, /// Replaces the selected text in an edit control or a rich edit control with the specified text. - /// - /// Parameters - /// + /// Parameters /// wParam - /// Specifies whether the replacement operation can be undone. If this is TRUE, the operation can be undone. If this is FALSE , the operation cannot be undone. + /// + /// Specifies whether the replacement operation can be undone. If this is TRUE, the operation can be undone. If this is + /// FALSE , the operation cannot be undone. + /// /// lParam /// A pointer to a null-terminated string containing the replacement text. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// - /// Use the EM_REPLACESEL message to replace only a portion of the text in an edit control. To replace all of the text, use the WM_SETTEXT message. + /// + /// Use the EM_REPLACESEL message to replace only a portion of the text in an edit control. To replace all of the text, use + /// the WM_SETTEXT message. + /// /// If there is no selection, the replacement text is inserted at the caret. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. - /// In a rich edit control, the replacement text takes the formatting of the character at the caret or, if there is a selection, of the first character in the selection. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + /// In a rich edit control, the replacement text takes the formatting of the character at the caret or, if there is a selection, of + /// the first character in the selection. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-replacesel [MsgParams(typeof(BOOL), typeof(string), LResultType = null)] EM_REPLACESEL = 0x00C2, - /// Copies a line of text from an edit control and places it in a specified buffer. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Copies a line of text from an edit control and places it in a specified buffer. You can send this message to either an edit + /// control or a rich edit control. + /// + /// Parameters /// wParam - /// The zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This parameter is ignored by a single-line edit control. - /// lParam - /// A pointer to the buffer that receives a copy of the line. Before sending the message, set the first word of this buffer to the size, in TCHARs, of the buffer. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. The size in the first word is overwritten by the copied line. /// - /// Returns + /// The zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This + /// parameter is ignored by a single-line edit control. + /// + /// lParam + /// + /// A pointer to the buffer that receives a copy of the line. Before sending the message, set the first word of this buffer to the + /// size, in TCHAR s, of the buffer. For ANSI text, this is the number of bytes; for Unicode text, this is the number of + /// characters. The size in the first word is overwritten by the copied line. + /// + /// Returns + /// + /// The return value is the number of TCHAR s copied. The return value is zero if the line number specified by the wParam + /// parameter is greater than the number of lines in the edit control. /// - /// The return value is the number of TCHARs copied. The return value is zero if the line number specified by the wParam parameter is greater than the number of lines in the edit control. /// /// Edit controls: The copied line does not contain a terminating null character. - /// Rich edit controls: Supported in Microsoft Rich Edit 1.0 and later. The copied line does not contain a terminating null character, unless no text was copied. If no text was copied, the message places a null character at the beginning of the buffer. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich edit controls: Supported in Microsoft Rich Edit 1.0 and later. The copied line does not contain a terminating null + /// character, unless no text was copied. If no text was copied, the message places a null character at the beginning of the buffer. + /// For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getline [MsgParams(typeof(int), typeof(StrPtrAuto), LResultType = typeof(int))] EM_GETLINE = 0x00C4, /// - /// Sets the text limit of an edit control. The text limit is the maximum amount of text, in TCHARs, that the user can type into the edit control. You can send this message to either an edit control or a rich edit control. + /// + /// Sets the text limit of an edit control. The text limit is the maximum amount of text, in TCHAR s, that the user can type + /// into the edit control. You can send this message to either an edit control or a rich edit control. + /// /// For edit controls and Microsoft Rich Edit 1.0, bytes are used. For Microsoft Rich Edit 2.0 and later, characters are used. /// - /// - /// Parameters - /// + /// Parameters /// wParam - /// The maximum number of TCHARs the user can enter. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. This number does not include the terminating null character. + /// + /// The maximum number of TCHAR s the user can enter. For ANSI text, this is the number of bytes; for Unicode text, this is + /// the number of characters. This number does not include the terminating null character. + /// /// Rich edit controls: If this parameter is zero, the text length is set to 64,000 characters. - /// If this parameter is zero, the text length is set to 0x7FFFFFFE characters for single-line edit controls or -1 for multiline edit controls. + /// + /// If this parameter is zero, the text length is set to 0x7FFFFFFE characters for single-line edit controls or -1 for multiline edit controls. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// - /// The EM_LIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the EM_LIMITTEXT message, the user can edit the entire contents of the edit control. - /// Before EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters. - /// For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either -1 byte or the value of the wParam parameter, whichever is smaller. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. Use the message EM_EXLIMITTEXT for text length values greater than 64,000. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// The EM_LIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control + /// when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. + /// If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the + /// EM_LIMITTEXT message, the user can edit the entire contents of the edit control. + /// + /// + /// Before EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters. + /// + /// + /// For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is + /// smaller. For multiline edit controls, this value is either -1 byte or the value of the wParam parameter, whichever is smaller. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. Use the message EM_EXLIMITTEXT for text length values + /// greater than 64,000. For information about the compatibility of rich edit versions with the various system versions, see About + /// Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-limittext [MsgParams(typeof(int), null, LResultType = null)] EM_LIMITTEXT = 0x00C5, - /// Determines whether there are any actions in an edit control's undo queue. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Determines whether there are any actions in an edit control's undo queue. You can send this message to either an edit control or + /// a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. - /// - /// Returns - /// + /// Returns /// If there are actions in the control's undo queue, the return value is nonzero. /// If the undo queue is empty, the return value is zero. /// /// If the undo queue is not empty, you can send the EM_UNDO message to the control to undo the most recent operation. /// Edit controls and Rich Edit 1.0: The undo queue contains only the most recent operation. /// Rich Edit 2.0 and later: The undo queue can contain multiple operations. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-canundo [MsgParams(LResultType = typeof(BOOL))] EM_CANUNDO = 0x00C6, - /// This message undoes the last edit control operation in the control's undo queue. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// This message undoes the last edit control operation in the control's undo queue. You can send this message to either an edit + /// control or a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. - /// - /// Returns - /// + /// Returns /// For a single-line edit control, the return value is always TRUE. - /// For a multiline edit control, the return value is TRUE if the undo operation is successful, or FALSE if the undo operation fails. + /// + /// For a multiline edit control, the return value is TRUE if the undo operation is successful, or FALSE if the undo + /// operation fails. + /// /// - /// Edit controls and Rich Edit 1.0: An undo operation can also be undone. For example, you can restore deleted text with the first EM_UNDO message, and remove the text again with a second EM_UNDO message as long as there is no intervening edit operation. - /// Rich Edit 2.0 and later: The undo feature is multilevel so sending two EM_UNDO messages will undo the last two operations in the undo queue. To redo an operation, send the EM_REDO message. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Edit controls and Rich Edit 1.0: An undo operation can also be undone. For example, you can restore deleted text with the + /// first EM_UNDO message, and remove the text again with a second EM_UNDO message as long as there is no intervening + /// edit operation. + /// + /// + /// Rich Edit 2.0 and later: The undo feature is multilevel so sending two EM_UNDO messages will undo the last two + /// operations in the undo queue. To redo an operation, send the EM_REDO message. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-undo [MsgParams(LResultType = typeof(BOOL))] EM_UNDO = 0x00C7, - /// Sets a flag that determines whether a multiline edit control includes soft line-break characters. A soft line break consists of two carriage returns and a line feed and is inserted at the end of a line that is broken because of wordwrapping. - /// - /// Parameters - /// + /// + /// Sets a flag that determines whether a multiline edit control includes soft line-break characters. A soft line break consists of + /// two carriage returns and a line feed and is inserted at the end of a line that is broken because of wordwrapping. + /// + /// Parameters /// wParam - /// Specifies whether soft line-break characters are to be inserted. A value of TRUE inserts the characters; a value of FALSE removes them. + /// + /// Specifies whether soft line-break characters are to be inserted. A value of TRUE inserts the characters; a value of + /// FALSE removes them. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// The return value is identical to the wParam parameter. /// - /// This message affects only the buffer returned by the EM_GETHANDLE message and the text returned by the WM_GETTEXT message. It has no effect on the display of the text within the edit control. - /// The EM_FMTLINES message does not affect a line that ends with a hard line break. A hard line break consists of one carriage return and a line feed. - /// Note The size of the text changes when this message is processed. + /// + /// This message affects only the buffer returned by the EM_GETHANDLE message and the text returned by the WM_GETTEXT + /// message. It has no effect on the display of the text within the edit control. + /// + /// + /// The EM_FMTLINES message does not affect a line that ends with a hard line break. A hard line break consists of one + /// carriage return and a line feed. + /// + /// + /// Note + /// The size of the text changes when this message is processed. + /// /// Rich Edit: The EM_FMTLINES message is not supported. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-fmtlines [MsgParams(typeof(BOOL), null, LResultType = typeof(BOOL))] EM_FMTLINES = 0x00C8, - /// Gets the index of the line that contains the specified character index in a multiline edit control. A character index is the zero-based index of the character from the beginning of the edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the index of the line that contains the specified character index in a multiline edit control. A character index is the + /// zero-based index of the character from the beginning of the edit control. You can send this message to either an edit control or + /// a rich edit control. + /// + /// Parameters /// wParam - /// The character index of the character contained in the line whose number is to be retrieved. If this parameter is -1, EM_LINEFROMCHAR retrieves either the line number of the current line (the line containing the caret) or, if there is a selection, the line number of the line containing the beginning of the selection. + /// + /// The character index of the character contained in the line whose number is to be retrieved. If this parameter is -1, + /// EM_LINEFROMCHAR retrieves either the line number of the current line (the line containing the caret) or, if there is a + /// selection, the line number of the line containing the beginning of the selection. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// The return value is the zero-based line number of the line containing the character index specified by wParam. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. If the character index is greater than 64,000, use the EM_EXLINEFROMCHAR message. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. If the character index is greater than 64,000, use the + /// EM_EXLINEFROMCHAR message. For information about the compatibility of rich edit versions with the various system versions, + /// see About Rich Edit Controls. + /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-linefromchar [MsgParams(typeof(int), null, LResultType = typeof(int))] EM_LINEFROMCHAR = 0x00C9, /// - /// The EM_SETTABSTOPS message sets the tab stops in a multiline edit control. When text is copied to the control, any tab character in the text causes space to be generated up to the next tab stop. - /// This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. + /// + /// The EM_SETTABSTOPS message sets the tab stops in a multiline edit control. When text is copied to the control, any tab + /// character in the text causes space to be generated up to the next tab stop. + /// + /// + /// This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control. + /// /// - /// - /// Parameters - /// + /// Parameters /// wParam - /// The number of tab stops contained in the array. If this parameter is zero, the lParam parameter is ignored and default tab stops are set at every 32 dialog template units. If this parameter is 1, tab stops are set at every n dialog template units, where n is the distance pointed to by the lParam parameter. If this parameter is greater than 1, lParam is a pointer to an array of tab stops. - /// lParam - /// A pointer to an array of unsigned integers specifying the tab stops, in dialog template units. If the wParam parameter is 1, this parameter is a pointer to an unsigned integer containing the distance between all tab stops, in dialog template units. /// - /// Returns + /// The number of tab stops contained in the array. If this parameter is zero, the lParam parameter is ignored and default tab stops + /// are set at every 32 dialog template units. If this parameter is 1, tab stops are set at every n dialog template units, where n is + /// the distance pointed to by the lParam parameter. If this parameter is greater than 1, lParam is a pointer to an array of tab stops. /// + /// lParam + /// + /// A pointer to an array of unsigned integers specifying the tab stops, in dialog template units. If the wParam parameter is 1, this + /// parameter is a pointer to an unsigned integer containing the distance between all tab stops, in dialog template units. + /// + /// Returns /// If all the tabs are set, the return value is TRUE. /// If all the tabs are not set, the return value is FALSE. /// - /// The EM_SETTABSTOPS message does not automatically redraw the edit control window. If the application is changing the tab stops for text already in the edit control, it should call the InvalidateRect function to redraw the edit control window. - /// The values specified in the array are in dialog template units, which are the device-independent units used in dialog box templates. To convert measurements from dialog template units to screen units (pixels), use the MapDialogRect function. - /// Rich Edit: Supported in Microsoft Rich Edit 3.0 and later. A rich edit control can have the maximum number of tab stops specified by MAX_TAB_STOPS. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// The EM_SETTABSTOPS message does not automatically redraw the edit control window. If the application is changing the tab + /// stops for text already in the edit control, it should call the InvalidateRect function to redraw the edit control window. + /// + /// + /// The values specified in the array are in dialog template units, which are the device-independent units used in dialog box + /// templates. To convert measurements from dialog template units to screen units (pixels), use the MapDialogRect function. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 3.0 and later. A rich edit control can have the maximum number of tab stops + /// specified by MAX_TAB_STOPS. For information about the compatibility of rich edit versions with the various system versions, see + /// About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settabstops [MsgParams(typeof(uint), typeof(uint[]), LResultType = typeof(BOOL))] EM_SETTABSTOPS = 0x00CB, - /// Sets or removes the password character for an edit control. When a password character is set, that character is displayed in place of the characters typed by the user. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Sets or removes the password character for an edit control. When a password character is set, that character is displayed in + /// place of the characters typed by the user. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam - /// The character to be displayed in place of the characters typed by the user. If this parameter is zero, the control removes the current password character and displays the characters typed by the user. + /// + /// The character to be displayed in place of the characters typed by the user. If this parameter is zero, the control removes the + /// current password character and displays the characters typed by the user. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// - /// When an edit control receives the EM_SETPASSWORDCHAR message, the control redraws all visible characters using the character specified by the wParam parameter. If wParam is zero, the control redraws all visible characters using the characters typed by the user. - /// If an edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*). If an edit control is created without the ES_PASSWORD style, there is no password character. The ES_PASSWORD style is removed if an EM_SETPASSWORDCHAR message is sent with the wParam parameter set to zero. + /// + /// When an edit control receives the EM_SETPASSWORDCHAR message, the control redraws all visible characters using the + /// character specified by the wParam parameter. If wParam is zero, the control redraws all visible characters using the characters + /// typed by the user. + /// + /// + /// If an edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*). If an + /// edit control is created without the ES_PASSWORD style, there is no password character. The ES_PASSWORD style is + /// removed if an EM_SETPASSWORDCHAR message is sent with the wParam parameter set to zero. + /// /// Edit controls: Multiline edit controls do not support the password style or messages. - /// Rich Edit: Supported in Microsoft Rich Edit 2.0 and later. Both single-line and multiline edit controls support the password style and messages. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 2.0 and later. Both single-line and multiline edit controls support the + /// password style and messages. For information about the compatibility of rich edit versions with the various system versions, see + /// About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpasswordchar [MsgParams(typeof(char), null, LResultType = null)] EM_SETPASSWORDCHAR = 0x00CC, - /// Resets the undo flag of an edit control. The undo flag is set whenever an operation within the edit control can be undone. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Resets the undo flag of an edit control. The undo flag is set whenever an operation within the edit control can be undone. You + /// can send this message to either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. - /// - /// Returns - /// + /// Returns /// This message does not return a value. /// /// The undo flag is automatically reset whenever the edit control receives a WM_SETTEXT or EM_SETHANDLE message. /// Edit controls and Rich Edit 1.0: The control can only undo or redo the most recent operation. - /// Rich Edit 2.0 and later: The EM_EMPTYUNDOBUFFER message empties all undo and redo buffers. Rich edit controls enable the user to undo or redo multiple operations. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// Rich Edit 2.0 and later: The EM_EMPTYUNDOBUFFER message empties all undo and redo buffers. Rich edit controls + /// enable the user to undo or redo multiple operations. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-emptyundobuffer [MsgParams(LResultType = null)] EM_EMPTYUNDOBUFFER = 0x00CD, - /// Gets the zero-based index of the uppermost visible line in a multiline edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Gets the zero-based index of the uppermost visible line in a multiline edit control. You can send this message to either an edit + /// control or a rich edit control. + /// + /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. - /// - /// Returns - /// + /// Returns /// The return value is the zero-based index of the uppermost visible line in a multiline edit control. /// Edit controls: For single-line edit controls, the return value is the zero-based index of the first visible character. /// Rich edit controls: For single-line rich edit controls, the return value is zero. /// - /// The number of lines and the length of the lines in an edit control depend on the width of the control and the current Wordwrap setting. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// The number of lines and the length of the lines in an edit control depend on the width of the control and the current Wordwrap setting. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getfirstvisibleline [MsgParams(LResultType = typeof(int))] EM_GETFIRSTVISIBLELINE = 0x00CE, - /// Sets or removes the read-only style (ES_READONLY) of an edit control. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Sets or removes the read-only style ( ES_READONLY) of an edit control. You can send this message to either an edit control + /// or a rich edit control. + /// + /// Parameters /// wParam - /// Specifies whether to set or remove the ES_READONLY style. A value of TRUE sets the ES_READONLY style; a value of FALSE removes the ES_READONLY style. + /// + /// Specifies whether to set or remove the ES_READONLY style. A value of TRUE sets the ES_READONLY style; a + /// value of FALSE removes the ES_READONLY style. + /// /// lParam /// This parameter is not used. - /// - /// Returns - /// + /// Returns /// If the operation succeeds, the return value is nonzero. /// If the operation fails, the return value is zero. /// /// When an edit control has the ES_READONLY style, the user cannot change the text within the edit control. - /// To determine whether an edit control has the ES_READONLY style, use the GetWindowLong function with the GWL_STYLE flag. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// To determine whether an edit control has the ES_READONLY style, use the GetWindowLong function with the GWL_STYLE flag. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setreadonly [MsgParams(typeof(BOOL), null, LResultType = typeof(BOOL))] EM_SETREADONLY = 0x00CF, - /// Replaces an edit control's default Wordwrap function with an application-defined Wordwrap function. You can send this message to either an edit control or a rich edit control. - /// - /// Parameters - /// + /// + /// Replaces an edit control's default Wordwrap function with an application-defined Wordwrap function. You can send this message to + /// either an edit control or a rich edit control. + /// + /// Parameters /// wParam /// This parameter is not used. /// lParam - /// The address of the application-defined Wordwrap function. For more information about breaking lines, see the description of the EditWordBreakProc callback function. /// - /// Returns + /// The address of the application-defined Wordwrap function. For more information about breaking lines, see the description of the + /// EditWordBreakProc callback function. /// + /// Returns /// This message does not return a value. /// - /// A Wordwrap function scans a text buffer that contains text to be sent to the screen, looking for the first word that does not fit on the current screen line. The Wordwrap function places this word at the beginning of the next line on the screen. - /// A Wordwrap function defines the point at which the system should break a line of text for multiline edit controls, usually at a space character that separates two words. Either a multiline or a single-line edit control might call this function when the user presses arrow keys in combination with the CTRL key to move the caret to the next word or previous word. The default Wordwrap function breaks a line of text at a space character. The application-defined function may define the Wordwrap to occur at a hyphen or a character other than the space character. - /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// A Wordwrap function scans a text buffer that contains text to be sent to the screen, looking for the first word that does not fit + /// on the current screen line. The Wordwrap function places this word at the beginning of the next line on the screen. + /// + /// + /// A Wordwrap function defines the point at which the system should break a line of text for multiline edit controls, usually at a + /// space character that separates two words. Either a multiline or a single-line edit control might call this function when the user + /// presses arrow keys in combination with the CTRL key to move the caret to the next word or previous word. The default Wordwrap + /// function breaks a line of text at a space character. The application-defined function may define the Wordwrap to occur at a + /// hyphen or a character other than the space character. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setwordbreakproc - [MsgParams(null, typeof(EditWordBreakProc), LResultType = null)] + [MsgParams(null, typeof(EDITWORDBREAKPROC), LResultType = null)] EM_SETWORDBREAKPROC = 0x00D0, - EM_GETWORDBREAKPROC = 0x00D1, - EM_GETPASSWORDCHAR = 0x00D2, - EM_SETMARGINS = 0x00D3, - EM_GETMARGINS = 0x00D4, - EM_SETLIMITTEXT = EM_LIMITTEXT, /* ;win40 Name change */ - EM_GETLIMITTEXT = 0x00D5, - EM_POSFROMCHAR = 0x00D6, - EM_CHARFROMPOS = 0x00D7, - EM_SETIMESTATUS = 0x00D8, - EM_GETIMESTATUS = 0x00D9, - EM_ENABLEFEATURE = 0x00DA, - EM_SETCUEBANNER = ECM_FIRST + 1, // Set the cue banner with the lParm = LPCWSTR - EM_GETCUEBANNER = ECM_FIRST + 2, // Set the cue banner with the lParm = LPCWSTR - EM_SHOWBALLOONTIP = ECM_FIRST + 3, // Show a balloon tip associated to the edit control - EM_HIDEBALLOONTIP = ECM_FIRST + 4, // Hide any balloon tip associated with the edit control + /// + /// Gets the address of the current Wordwrap function. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// + /// The return value specifies the address of the application-defined Wordwrap function. The return value is NULL if no + /// Wordwrap function exists. + /// + /// + /// + /// A Wordwrap function scans a text buffer that contains text to be sent to the display, looking for the first word that does not + /// fit on the current display line. The wordwrap function places this word at the beginning of the next line on the display. A + /// Wordwrap function defines the point at which the system should break a line of text for multiline edit controls, usually at a + /// space character that separates two words. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getwordbreakproc + [MsgParams(LResultType = typeof(EDITWORDBREAKPROC))] + EM_GETWORDBREAKPROC = 0x00D1, + + /// + /// Gets the password character that an edit control displays when the user enters text. You can send this message to either an edit + /// control or a rich edit control. + /// + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// + /// The return value specifies the character to be displayed in place of any characters typed by the user. If the return value is + /// NULL, there is no password character, and the control displays the characters typed by the user. + /// + /// + /// + /// If an edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*). If an + /// edit control is created without the ES_PASSWORD style, there is no password character. To change the password character, + /// send the EM_SETPASSWORDCHAR message. + /// + /// Edit controls: Multiline edit controls do not support the password style or messages. + /// + /// Rich edit: Supported in Microsoft Rich Edit 2.0 and later. Both single-line and multiline edit controls support the + /// password style and messages. For information about the compatibility of rich edit versions with the various system versions, see + /// About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getpasswordchar + [MsgParams(LResultType = typeof(char))] + EM_GETPASSWORDCHAR = 0x00D2, + + /// + /// Sets the widths of the left and right margins for an edit control. The message redraws the control to reflect the new margins. + /// You can send this message to either an edit control or a rich edit control. + /// + /// Parameters + /// wParam + /// The margins to set. This parameter can be one or more of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// EC_LEFTMARGIN + /// Sets the left margin. + /// + /// + /// EC_RIGHTMARGIN + /// Sets the right margin. + /// + /// + /// EC_USEFONTINFO + /// + /// Rich edit controls: Sets the left and right margins to a narrow width calculated using the text metrics of the control's + /// current font. If no font has been set for the control, the margins are set to zero. The lParam parameter is ignored. + /// Edit controls: The EC_USEFONTINFO value cannot be used in the wParam parameter. It can only be used in the + /// lParam parameter. + /// + /// + /// + /// lParam + /// + /// The LOWORD specifies the new width of the left margin, in pixels. This value is ignored if wParam does not include EC_LEFTMARGIN. + /// + /// + /// Edit controls and Rich Edit 3.0 and later: The LOWORD can specify the EC_USEFONTINFO value to set the left + /// margin to a narrow width calculated using the text metrics of the control's current font. If no font has been set for the + /// control, the margin is set to zero. + /// + /// + /// The HIWORD specifies the new width of the right margin, in pixels. This value is ignored if wParam does not include EC_RIGHTMARGIN. + /// + /// + /// Edit controls and Rich Edit 3.0 and later: The HIWORD can specify the EC_USEFONTINFO value to set the right + /// margin to a narrow width calculated using the text metrics of the control's current font. If no font has been set for the + /// control, the margin is set to zero. + /// + /// Returns + /// This message does not return a value. + /// + /// Edit controls: You cannot use EC_USEFONTINFO in the wParam parameter, but you can use it in the lParam parameter. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. All rich edit versions support the use of EC_USEFONTINFO + /// in the wParam parameter. However, only Microsoft Rich Edit 3.0 and later support the use of EC_USEFONTINFO in the lParam + /// parameter. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setmargins + [MsgParams(typeof(EC), typeof(uint), LResultType = null)] + EM_SETMARGINS = 0x00D3, + + /// Gets the widths of the left and right margins for an edit control. + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// Returns the width of the left margin in the LOWORD, and the width of the right margin in the HIWORD. + /// Rich Edit: The EM_GETMARGINS message is not supported. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getmargins + [MsgParams(LResultType = typeof(uint))] + EM_GETMARGINS = 0x00D4, + + /// + /// + /// Sets the text limit of an edit control. The text limit is the maximum amount of text, in TCHAR s, that the user can type + /// into the edit control. You can send this message to either an edit control or a rich edit control. + /// + /// For edit controls and Microsoft Rich Edit 1.0, bytes are used. For Microsoft Rich Edit 2.0 and later, characters are used. + /// + /// Parameters + /// wParam + /// + /// The maximum number of TCHAR s the user can enter. For ANSI text, this is the number of bytes; for Unicode text, this is + /// the number of characters. This number does not include the terminating null character. + /// + /// Rich edit controls: If this parameter is zero, the text length is set to 64,000 characters. + /// + /// If this parameter is zero, the text length is set to 0x7FFFFFFE characters for single-line edit controls or -1 for multiline edit controls. + /// + /// lParam + /// This parameter is not used. + /// Returns + /// This message does not return a value. + /// + /// + /// The EM_LIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control + /// when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. + /// If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the + /// EM_LIMITTEXT message, the user can edit the entire contents of the edit control. + /// + /// + /// Before EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters. + /// + /// + /// For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is + /// smaller. For multiline edit controls, this value is either -1 byte or the value of the wParam parameter, whichever is smaller. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. Use the message EM_EXLIMITTEXT for text length values + /// greater than 64,000. For information about the compatibility of rich edit versions with the various system versions, see About + /// Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-limittext + [MsgParams(typeof(int), null, LResultType = null)] + EM_SETLIMITTEXT = EM_LIMITTEXT, /* ;win40 Name change */ + + /// + /// Gets the current text limit for an edit control. You can send this message to either an edit control or a rich edit control. + /// + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// The return value is the text limit. + /// + /// + /// Edit controls, Rich Edit 2.0 and later: The text limit is the maximum amount of text, in TCHAR s, that the control + /// can contain. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. Two documents with + /// the same character limit will yield the same text limit, even if one is ANSI and the other is Unicode. + /// + /// Rich Edit 1.0: The text limit is the maximum amount of text, in bytes, that the rich edit control can contain. + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getlimittext + [MsgParams(LResultType = typeof(int))] + EM_GETLIMITTEXT = 0x00D5, + + /// + /// Retrieves the client area coordinates of a specified character in an edit control. You can send this message to either an edit + /// control or a rich edit control. + /// + /// Parameters + /// wParam + /// + /// Rich Edit 1.0 and 3.0: A pointer to a POINTL structure that receives the client area coordinates of the character. + /// The coordinates are in screen units and are relative to the upper-left corner of the control's client area. + /// + /// Edit controls and Rich Edit 2.0: The zero-based index of the character. + /// lParam + /// Rich Edit 1.0 and 3.0: The zero-based index of the character. + /// Edit controls and Rich Edit 2.0: This parameter is not used. + /// Returns + /// Rich Edit 1.0 and 3.0: The return value is not used. + /// + /// Edit controls and Rich Edit 2.0: The return value contains the client area coordinates of the character. The LOWORD + /// contains the horizontal coordinate and the HIWORD contains the vertical coordinate. + /// + /// + /// + /// A returned coordinate can be a negative value if the specified character is not displayed in the edit control's client area. The + /// coordinates are truncated to integer values. + /// + /// + /// If the character is a line delimiter, the returned coordinates indicate a point just beyond the last visible character in the + /// line. If the specified index is greater than the index of the last character in the control, the control returns -1. + /// + /// + /// Rich Edit 3.0 and later: For backward compatibility, Microsoft Rich Edit 3.0 supports the syntax used by Microsoft Rich + /// Edit 2.0. If Microsoft Rich Edit 3.0 detects that wParam is not a valid POINTL pointer, it assumes the message was sent + /// using the Microsoft Rich Edit 2.0 syntax. In this case, it uses the return value to return the coordinates. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-posfromchar + [MsgParams(typeof(IntPtr), typeof(uint), LResultType = typeof(uint))] + EM_POSFROMCHAR = 0x00D6, + + /// + /// Gets information about the character closest to a specified point in the client area of an edit control. You can send this + /// message to either an edit control or a rich edit control. + /// + /// Parameters + /// wParam + /// This parameter is not used. + /// lParam + /// + /// The coordinates of a point in the control's client area. The coordinates are in screen units and are relative to the upper-left + /// corner of the control's client area. + /// + /// Rich edit controls: A pointer to a POINTL structure that contains the horizontal and vertical coordinates. + /// Edit controls: The LOWORD contains the horizontal coordinate. The HIWORD contains the vertical coordinate. + /// Returns + /// + /// Rich edit controls: The return value specifies the zero-based character index of the character nearest the specified + /// point. The return value indicates the last character in the edit control if the specified point is beyond the last character in + /// the control. + /// + /// + /// Edit controls: The LOWORD specifies the zero-based index of the character nearest the specified point. This index + /// is relative to the beginning of the control, not the beginning of the line. If the specified point is beyond the last character + /// in the edit control, the return value indicates the last character in the control. The HIWORD specifies the zero-based + /// index of the line that contains the character. For single-line edit controls, this value is zero. The index indicates the line + /// delimiter if the specified point is beyond the last visible character in a line. + /// + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + /// If a point is passed to EM_CHARFROMPOS as the lParam and the point is outside the bounds of the edit control, then the + /// lResult is (65535, 65535). + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-charfrompos + [MsgParams(null, typeof(IntPtr), LResultType = typeof(uint))] + EM_CHARFROMPOS = 0x00D7, + + /// Sets the status flags that determine how an edit control interacts with the Input Method Editor (IME). + /// Parameters + /// wParam + /// The type of status to set. This parameter can be the following value. + /// + /// + /// Value + /// Meaning + /// + /// + /// EMSIS_COMPOSITIONSTRING + /// Sets behavior for the handling composition string. + /// + /// + /// lParam + /// + /// Data specific to the status type. If wParam is EMSIS_COMPOSITIONSTRING, this parameter can be one or more of the following values. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// EIMES_GETCOMPSTRATONCE + /// + /// If this flag is set, the edit control hooks the WM_IME_COMPOSITION message with lParam set to GCS_RESULTSTR and + /// returns the result string immediately. If this flag is not set, the edit control passes the WM_IME_COMPOSITION message to + /// the default window procedure and handles the result string from the WM_CHAR message; this is the default behavior of the + /// edit control. + /// + /// + /// + /// EIMES_CANCELCOMPSTRINFOCUS + /// + /// If this flag is set, the edit control cancels the composition string when it receives the WM_SETFOCUS message. If this + /// flag is not set, the edit control does not cancel the composition string; this is the default behavior of the edit control. + /// + /// + /// + /// EIMES_COMPLETECOMPSTRKILLFOCUS + /// + /// If this flag is set, the edit control completes the composition string upon receiving the WM_KILLFOCUS message. If this + /// flag is not set, the edit control does not complete the composition string; this is the default behavior of the edit control. + /// + /// + /// + /// Returns + /// Returns the previous value of the lParam parameter. + /// Rich Edit: The EM_SETIMESTATUS message is not supported. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimestatus + [MsgParams(typeof(EMSIS), typeof(EIMES), LResultType = typeof(EIMES))] + EM_SETIMESTATUS = 0x00D8, + + /// Gets a set of status flags that indicate how the edit control interacts with the Input Method Editor (IME). + /// Parameters + /// wParam + /// The type of status to retrieve. This parameter can be the following value. + /// + /// + /// Value + /// Meaning + /// + /// + /// EMSIS_COMPOSITIONSTRING + /// Sets behavior for handling the composition string. + /// + /// + /// lParam + /// This parameter is not used. + /// Returns + /// + /// Data specific to the type of status to retrieve. With the EMSIS_COMPOSITIONSTRING value for status, this return value is + /// one or more of the following values. + /// + /// + /// + /// Return code + /// Description + /// + /// + /// EIMES_GETCOMPSTRATONCE + /// + /// If this flag is set, the edit control hooks the WM_IME_COMPOSITION message with fFlags set to GCS_RESULTSTR and + /// returns the result string immediately. If this flag is not set, the edit control passes the WM_IME_COMPOSITION message to + /// the default window procedure and processes the result string from the WM_CHAR message; this is the default behavior of the + /// edit control. + /// + /// + /// + /// EIMES_CANCELCOMPSTRINFOCUS + /// + /// If this flag is set, the edit control cancels the composition string when it receives the WM_SETFOCUS message. If this + /// flag is not set, the edit control does not cancel the composition string; this is the default behavior of the edit control. + /// + /// + /// + /// EIMES_COMPLETECOMPSTRKILLFOCUS + /// + /// If this flag is set, the edit control completes the composition string upon receiving the WM_KILLFOCUS message. If this + /// flag is not set, the edit control does not complete the composition string; this is the default behavior of the edit control. + /// + /// + /// + /// Rich Edit: The EM_GETIMESTATUS message is not supported. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimestatus + [MsgParams(typeof(EMSIS), null, LResultType = typeof(EIMES))] + EM_GETIMESTATUS = 0x00D9, + + /// Undocumented + EM_ENABLEFEATURE = 0x00DA, + + /// Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information. + /// Parameters + /// wParam + /// + /// TRUE if the cue banner should show even when the edit control has focus; otherwise, FALSE. FALSE is the + /// default behavior the cue banner disappears when the user clicks in the control. + /// + /// lParam + /// A pointer to a Unicode string that contains the text to display as the textual cue. + /// Returns + /// If the message succeeds, it returns TRUE. Otherwise it returns FALSE. + /// + /// + /// An edit control that is used to begin a search may display "Enter search here" in gray text as a textual cue. When the user + /// clicks the text, the text goes away and the user can type. + /// + /// You cannot set a cue banner on a multiline edit control or on a rich edit control. + /// + /// Note + /// + /// To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling + /// Visual Styles. + /// + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setcuebanner + [MsgParams(typeof(BOOL), typeof(StrPtrUni), LResultType = typeof(BOOL))] + EM_SETCUEBANNER = ECM_FIRST + 1, // Set the cue banner with the lParm = LPCWSTR + + /// Gets the text that is displayed as the textual cue, or tip, in an edit control. + /// Parameters + /// wParam + /// + /// A pointer to a Unicode buffer that receives the text set as the textual cue. The caller is responsible for allocating the buffer. + /// + /// lParam + /// The size of the buffer pointed to by wParam in WCHARs, including the terminating NULL. + /// Returns + /// Returns TRUE if successful or FALSE otherwise. + /// + /// Note + /// + /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see + /// Enabling Visual Styles. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getcuebanner + [MsgParams(typeof(StrPtrUni), typeof(uint), LResultType = typeof(BOOL))] + EM_GETCUEBANNER = ECM_FIRST + 2, // Set the cue banner with the lParm = LPCWSTR + + /// The EM_SHOWBALLOONTIP message displays a balloon tip associated with an edit control. + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// A pointer to an EDITBALLOONTIP structure that contains information about the balloon tip to display. + /// Returns + /// If the message succeeds, it returns TRUE. Otherwise it returns FALSE. + /// + /// Note + /// + /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see + /// Enabling Visual Styles. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-showballoontip + [MsgParams(null, typeof(EDITBALLOONTIP?), LResultType = typeof(BOOL))] + EM_SHOWBALLOONTIP = ECM_FIRST + 3, // Show a balloon tip associated to the edit control + + /// Hides any balloon tip associated with an edit control. + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// If the message succeeds, it returns TRUE. Otherwise it returns FALSE. + /// + /// Note + /// + /// To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see + /// Enabling Visual Styles. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/Controls/em-hideballoontip + [MsgParams(LResultType = typeof(BOOL))] + EM_HIDEBALLOONTIP = ECM_FIRST + 4, // Hide any balloon tip associated with the edit control + //EM_SETHILITE = ECM_FIRST + 5, //EM_GETHILITE = ECM_FIRST + 6, - EM_NOSETFOCUS = ECM_FIRST + 7, - EM_TAKEFOCUS = ECM_FIRST + 8, + + /// + /// + /// [Intended for internal use; not recommended for use in applications. This message may not be supported in future versions of Windows.] + /// + /// + /// Prevents a single-line edit control from receiving keyboard focus. You can send this message explicitly or by using the + /// Edit_NoSetFocus macro. + /// + /// + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// The return value is not used. + /// + /// This message is ignored if the edit control is not a single-line edit control. + /// After this message is sent, the effect is permanent. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-nosetfocus + [MsgParams(LResultType = null)] + EM_NOSETFOCUS = ECM_FIRST + 7, + + /// + /// + /// [Intended for internal use; not recommended for use in applications. This message may not be supported in future versions of Windows.] + /// + /// + /// Forces a single-line edit control to receive keyboard focus. You can send this message explicitly or by using the + /// Edit_TakeFocus macro. + /// + /// + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// The return value is not used. + /// + /// This message is ignored if the edit control is not a single-line edit control. + /// + /// If the edit control previously received an EM_NOSETFOCUS message, the edit control will appear to have the focus without + /// actually having it; otherwise, the edit control will receive focus. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-takefocus + [MsgParams(LResultType = null)] + EM_TAKEFOCUS = ECM_FIRST + 8, + + /// Informs the edit control to set extended styles. Send this message or use the macro Edit_SetExtendedStyle. + /// Parameters + /// wParam + /// Mask used to select the styles to be set. + /// lParam + /// Value that indicates the extended style. For more information on styles, see Edit Control Extended Styles. + /// Returns + /// If this message succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + /// The extended styles for an edit control have nothing to do with the extended styles used with function CreateWindowEx or + /// function SetWindowLong. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setextendedstyle + [MsgParams(typeof(EditStylesEx), typeof(EditStylesEx), LResultType = typeof(HRESULT))] + EM_SETEXTENDEDSTYLE = ECM_FIRST + 10, + + /// + /// Retrieves the extended style for a tree-view control. Send this message explicitly or by using the Edit_GetExtendedStyle macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns the value of extended style.For more information on styles, see Edit Control Extended Styles. + /// + /// The extended styles for an edit control have nothing to do with the extended styles used with function CreateWindowEx or + /// function SetWindowLong. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getextendedstyle + [MsgParams(LResultType = typeof(EditStylesEx))] + EM_GETEXTENDEDSTYLE = ECM_FIRST + 11, + + /// Sets the end-of-line character used when a linebreak is inserted. + /// Parameters + /// wParam + /// Specifies the end-of-line character used when a linebreak is inserted. This can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// EC_ENDOFLINE_DETECTFROMCONTENT + /// Sets the end-of-line character used for new linebreaks to the character used by the current document. + /// + /// + /// EC_ENDOFLINE_CRLF + /// Sets the end-of-line character used for new linebreaks to carriage return followed by linefeed (CRLF). + /// + /// + /// EC_ENDOFLINE_CR + /// Sets the end-of-line character used for new linebreaks to carriage return (CR). + /// + /// + /// EC_ENDOFLINE_LF + /// Sets the end-of-line character used for new linebreaks to linefeed (LF). + /// + /// + /// lParam + /// This parameter is not used. + /// Returns + /// If the operation succeeds, the return value is nonzero. + /// If the operation fails, the return value is zero. + /// + /// When the end-of-line character set is EC_ENDOFLINE_DETECTFROMCONTENT, the edit control will only detect end-of-line + /// characters supported according to its extended window style, see Edit Control Extended Styles. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setendofline + [MsgParams(typeof(EC_ENDOFLINE), null)] + EM_SETENDOFLINE = ECM_FIRST + 12, + + /// + /// Retrieves the end-of-line character for an edit control. Send this message explicitly or by using the Edit_GetEndOfLine macro. + /// + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// Returns the end-of-line character used by the edit control. This can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// EC_ENDOFLINE_CRLF + /// The end-of-line character used for new linebreaks is carriage return followed by linefeed (CRLF). + /// + /// + /// EC_ENDOFLINE_CR + /// The end-of-line character used for new linebreaks is carriage return (CR). + /// + /// + /// EC_ENDOFLINE_LF + /// The end-of-line character used for new linebreaks is linefeed (LF). + /// + /// + /// + /// When the end-of-line character used is set to EC_ENDOFLINE_DETECTFROMCONTENT using Edit_SetEndOfLine, this message + /// will return the detected end-of-line character. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getendofline + [MsgParams(LResultType = typeof(EC_ENDOFLINE))] + EM_GETENDOFLINE = ECM_FIRST + 13, + + /// Enables or disables the "Search the web" feature and context menu entry. + /// Parameters + /// wParam + /// A value of TRUE indicates the "Search the web" feature is enabled, and a value of FALSE indicates it is disabled. + /// lParam + /// This parameter is not used. + /// Returns + /// This message does not return a value. + /// If you disable "Search the web" using this message, the EM_SEARCHWEB message has no effect. + // https://learn.microsoft.com/en-us/windows/win32/Controls/em-enablesearchweb + [MsgParams(typeof(BOOL), null, LResultType = null)] + EM_ENABLESEARCHWEB = ECM_FIRST + 14, + + /// Opens the browser and performs a web search with the selected text as the search term. + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// This message does not return a value. + /// If the "Search the web" feature is disabled using the EM_ENABLESEARCHWEB message, this message has no effect. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-searchweb + [MsgParams(LResultType = null)] + EM_SEARCHWEB = ECM_FIRST + 15, + + /// Sets the zero-based index value of the position of the caret in an edit control. + /// Parameters + /// wParam + /// The new zero-based index value of the position of the caret. + /// lParam + /// Must be zero. + /// Returns + /// This message does not return a value. + /// + /// If the index is out of the range of the text in an edit control, the index will be adjusted to fit inside the range of the text. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setcaretindex + [MsgParams(typeof(uint), null, LResultType = null)] + EM_SETCARETINDEX = ECM_FIRST + 17, + + /// Gets the zero-based index of the position of the caret in an edit control. + /// Parameters + /// wParam + /// Must be zero. + /// lParam + /// Must be zero. + /// Returns + /// The return value is a zero-based index value of the position of the caret. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getcaretindex + [MsgParams(LResultType = typeof(uint))] + EM_GETCARETINDEX = ECM_FIRST + 18, + + /// + /// Gets the current zoom ratio for a multiline edit control or a rich edit control. The zoom ration is always between 1/64 and 64. + /// + /// Parameters + /// wParam + /// Receives the numerator of the zoom ratio. + /// lParam + /// Receives the denominator of the zoom ratio. + /// Returns + /// The message returns TRUE if message is processed, which it will be if both wParam and lParam are not NULL. + /// + /// Edit: Supported in Windows 10 1809 and later. The edit control needs to have the ES_EX_ZOOMABLE extended style set, + /// for this message to have an effect, see Edit Control Extended Styles. For information about the edit control, see Edit Controls. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getzoom + [MsgParams(typeof(uint), typeof(uint), LResultType = typeof(BOOL))] + EM_GETZOOM = (int)WM_USER + 224, + + /// + /// Sets the zoom ratio for a multiline edit control or a rich edit control. The ratio must be a value between 1/64 and 64. The edit + /// control needs to have the ES_EX_ZOOMABLE extended style set, for this message to have an effect, see Edit Control Extended Styles. + /// + /// Parameters + /// wParam + /// Numerator of the zoom ratio. + /// lParam + /// Denominator of the zoom ratio. These parameters can have the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// Both 0 + /// Turns off zooming by using the EM_SETZOOM message (zooming may still occur using TxGetExtent). + /// + /// + /// 1/64 < (wParam / lParam) < 64 + /// Zooms display by the zoom ratio numerator/denominator + /// + /// + /// Returns + /// If the new zoom setting is accepted, the return value is TRUE. + /// If the new zoom setting is not accepted, the return value is FALSE. + /// + /// Edit: Supported in Windows 10 1809 and later. The edit control needs to have the ES_EX_ZOOMABLE extended style set, + /// for this message to have an effect, see Edit Control Extended Styles. For information about the edit control, see Edit Controls. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-setzoom + [MsgParams(typeof(uint), typeof(uint), LResultType = typeof(BOOL))] + EM_SETZOOM = (int)WM_USER + 225, + + /// + /// Gets the index of the line that contains the specified character index in a multiline edit control, independently of how lines + /// are displayed on the screen. A character index is the zero-based index of the character from the beginning of the edit control. + /// + /// Parameters + /// wParam + /// + /// The character index of the character contained in the line whose number is to be retrieved. If this parameter is -1, + /// EM_FILELINEFROMCHAR retrieves either the line number of the current line (the line containing the caret) or, if there is a + /// selection, the line number of the line containing the beginning of the selection. + /// + /// lParam + /// This parameter is not used. + /// Returns + /// + /// The return value is the zero-based line number of the line containing the character index specified by wParam, independently of + /// how lines are displayed on the screen. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-filelinefromchar + [MsgParams(typeof(int), null, LResultType = typeof(uint))] + EM_FILELINEFROMCHAR = ECM_FIRST + 19, + + /// + /// Gets the character index of the first character of a specified line in a multiline edit control, independently of how lines are + /// displayed on the screen.. A character index is the zero-based index of the character from the beginning of the edit control. + /// + /// Parameters + /// wParam + /// The zero-based line number. A value of -1 specifies the current line number (the line that contains the caret). + /// lParam + /// This parameter is not used. + /// Returns + /// + /// The return value is the character index of the line specified in the wParam parameter, independently of how lines are displayed + /// on the screen, or it is -1 if the specified line number is greater than the number of lines in the edit control. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-filelineindex + [MsgParams(typeof(int), null, LResultType = typeof(int))] + EM_FILELINEINDEX = ECM_FIRST + 20, + + /// + /// Retrieves the length, in characters, of a line in an edit control, independently of how lines are displayed on the screen. + /// + /// Parameters + /// wParam + /// + /// The character index of a character in the line whose length is to be retrieved. If this parameter is greater than the number of + /// characters in the control, the return value is zero. + /// + /// + /// This parameter can be -1. In this case, the message returns the number of unselected characters on lines containing selected + /// characters. For example, if the selection extended from the fourth character of one line through the eighth character from the + /// end of the next line, the return value would be 10 (three characters on the first line and seven on the next). + /// + /// lParam + /// This parameter is not used. + /// Returns + /// + /// For multiline edit controls, the return value is the length, in TCHAR s, of the line specified by the wParam parameter, + /// independently of how lines are displayed on the screen. It does not include the carriage-return or linefeed character at the end + /// of the line. + /// + /// For single-line edit controls, the return value is the length, in TCHAR s, of the text in the edit control. + /// If wParam is greater than the number of characters in the control, the return value is zero. + /// + /// Use the EM_FILELINEINDEX message to retrieve a character index for a given line number within a multiline edit control, + /// independently of how lines are displayed on the screen. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-filelinelength + [MsgParams(typeof(int), null, LResultType = typeof(int))] + EM_FILELINELENGTH = ECM_FIRST + 21, + + /// + /// Copies a line of text from an edit control, independently of how lines are displayed on the screen, and places it in a specified buffer. + /// + /// Parameters + /// wParam + /// + /// The zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This + /// parameter is ignored by a single-line edit control. + /// + /// lParam + /// + /// A pointer to the buffer that receives a copy of the line. Before sending the message, set the first word of this buffer to the + /// size, in TCHAR s, of the buffer. For ANSI text, this is the number of bytes; for Unicode text, this is the number of + /// characters. The size in the first word is overwritten by the copied line. + /// + /// Returns + /// + /// The return value is the number of TCHAR s copied. The return value is zero if the line number specified by the wParam + /// parameter is greater than the number of lines in the edit control. + /// + /// The copied line does not contain a terminating null character. + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getfileline + EM_GETFILELINE = ECM_FIRST + 22, + + /// Gets the number of lines in a multiline edit control, independently of how lines are displayed on the screen. + /// Parameters + /// wParam + /// Not used; must be zero. + /// lParam + /// Not used; must be zero. + /// Returns + /// + /// The return value is an integer specifying the total number of text lines in the multiline edit control, independently of how + /// lines are displayed on the screen. If the control has no text, the return value is 1. The return value will never be less than 1. + /// + /// + /// + /// The EM_GETFILELINECOUNT message retrieves the total number of text lines, independently of how lines are displayed on the + /// screen, not just the number of lines that are currently visible. + /// + /// + /// Word-wrap does not change the number of lines this message returns, as this message works independently of how lines are + /// displayed on the screen. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/em-getfilelinecount + EM_GETFILELINECOUNT = ECM_FIRST + 23, } /// Edit control Notification Codes [PInvokeData("WinUser.h")] - public enum EditNotification + public enum EditNotification : uint { + /// + /// Sent after an edit control performed a web search when the "Search the web" feature is enabled, see EM_ENABLESEARCHWEB. The + /// parent window of the edit control receives this notification code through a WM_NOTIFY message. + /// + /// Parameters + /// wParam + /// Handle to the edit control. + /// lParam + /// A pointer to a NMSEARCHWEB structure. + // https://learn.microsoft.com/en-us/windows/win32/Controls/en-searchweb + [MsgParams(typeof(HWND), typeof(NMSEARCHWEB?))] + EN_SEARCHWEB = unchecked((uint)EN_FIRST - 0), + + /// + /// Sent when an edit control receives the keyboard focus. The parent window of the edit control receives this notification code + /// through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// The parent window always receives a WM_COMMAND message for this event, it does not require a notification mask sent with EM_SETEVENTMASK. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-setfocus + [MsgParams(typeof(uint), typeof(HWND))] EN_SETFOCUS = 0x0100, + + /// + /// Sent when an edit control loses the keyboard focus. The parent window of the edit control receives this notification code through + /// a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// Handle to the edit control. + /// + /// + /// The parent window always receives a WM_COMMAND message for this event, it does not require a notification mask sent with EM_SETEVENTMASK. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-killfocus + [MsgParams(typeof(uint), typeof(HWND))] EN_KILLFOCUS = 0x0200, + + /// + /// Sent when the user has taken an action that may have altered text in an edit control. Unlike the EN_UPDATE notification code, + /// this notification code is sent after the system updates the screen. The parent window of the edit control receives this + /// notification code through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive EN_CHANGE notification codes, specify + /// ENM_CHANGE in the mask sent with the EM_SETEVENTMASK message. For information about the compatibility of rich edit + /// versions with the various system versions, see About Rich Edit Controls. + /// + /// The EN_CHANGE notification code is not sent when the ES_MULTILINE style is used and the text is sent through WM_SETTEXT. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-change + [MsgParams(typeof(uint), typeof(HWND))] EN_CHANGE = 0x0300, + + /// + /// Sent when an edit control is about to redraw itself. This notification code is sent after the control has formatted the text, but + /// before it displays the text. This makes it possible to resize the edit control window, if necessary. The parent window of the + /// edit control receives this notification code through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// Rich Edit 1.0: To receive EN_UPDATE notification codes, specify ENM_UPDATE in the mask sent with the + /// EM_SETEVENTMASK message. + /// + /// + /// Rich Edit 2.0 and later: The ENM_UPDATE flag is ignored. The EN_UPDATE notification code is always received. + /// However, when Microsoft Rich Edit 3.0 emulates Microsoft Rich Edit 1.0, to receive EN_UPDATE notification codes you must specify + /// ENM_UPDATE in the mask sent with the EM_SETEVENTMASK message. + /// + /// For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-update + [MsgParams(typeof(uint), typeof(HWND))] EN_UPDATE = 0x0400, + + /// + /// Sent when an edit control cannot allocate enough memory to meet a specific request. The parent window of the edit control + /// receives this notification code through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// The parent window will always get a WM_COMMAND message for this event; it does not require a notification mask sent with + /// the EM_SETEVENTMASK message. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-errspace + [MsgParams(typeof(uint), typeof(HWND))] EN_ERRSPACE = 0x0500, + + /// + /// + /// Sent when the current text insertion has exceeded the specified number of characters for the edit control. The text insertion has + /// been truncated. + /// + /// + /// This notification code is also sent when an edit control does not have the ES_AUTOHSCROLL style and the number of + /// characters to be inserted would exceed the width of the edit control. + /// + /// + /// This notification code is also sent when an edit control does not have the ES_AUTOVSCROLL style and the total number of + /// lines resulting from a text insertion would exceed the height of the edit control. + /// + /// The parent window of the edit control receives this notification code through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// The parent window always receives a WM_COMMAND message for this event, it does not require a notification mask sent with EM_SETEVENTMASK. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions + /// with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/Controls/en-maxtext + [MsgParams(typeof(uint), typeof(HWND))] EN_MAXTEXT = 0x0501, + + /// + /// Sent when the user clicks an edit control's horizontal scroll bar. The parent window of the edit control receives this + /// notification code through a WM_COMMAND message. The parent window is notified before the screen is updated. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// This notification code is sent for the following mouse events on the horizontal scroll bar: clicking either arrow button or + /// clicking between the arrow button and the thumb. However, the notification code is not sent when clicking the scroll bar thumb + /// itself. The notification code is also sent when a keyboard event causes a change in the view area of the edit control, for + /// example, pressing HOME, END, LEFT ARROW, or RIGHT ARROW. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive EN_HSCROLL notification codes, specify + /// ENM_SCROLL in the mask sent with the EM_SETEVENTMASK message. For information about the compatibility of rich edit + /// versions with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-hscroll + [MsgParams(typeof(uint), typeof(HWND))] EN_HSCROLL = 0x0601, + + /// + /// Sent when the user clicks an edit control's vertical scroll bar or when the user scrolls the mouse wheel over the edit control. + /// The parent window of the edit control receives this notification code through a WM_COMMAND message. The parent window is + /// notified before the screen is updated. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control. + /// + /// + /// This message is sent for the following mouse events on the vertical scroll bar: clicking either arrow button or clicking between + /// the arrow button and the thumb. However, the message is not sent when clicking the scroll bar mouse itself. The message is also + /// sent when a keyboard event causes a change in the view area of the edit control, for example, pressing HOME, END, PAGE UP, PAGE + /// DOWN, UP ARROW, or DOWN ARROW. + /// + /// + /// The mouse wheel is a mouse that has a center wheel that scrolls. For more information, see "The Mouse Wheel" in About Mouse Input. + /// + /// + /// Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive EN_VSCROLL notification codes, specify + /// ENM_SCROLL in the mask sent with the EM_SETEVENTMASK message. For information about the compatibility of rich edit + /// versions with the various system versions, see About Rich Edit Controls. + /// + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-vscroll + [MsgParams(typeof(uint), typeof(HWND))] EN_VSCROLL = 0x0602, + + /// + /// Sent when the user has changed the edit control direction to left-to-right. The parent window of the edit control receives this + /// notification code through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control sending the notification code. + /// + /// + /// If there is a bidirectional language installed on your system, for example, Arabic or Hebrew, you can change the edit control + /// direction using CTRL+LSHIFT (for left to right) and CTRL+RSHIFT (for right to left). + /// + /// Rich Edit: This notification code is not supported. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-align-ltr-ec + [MsgParams(typeof(uint), typeof(HWND))] EN_ALIGN_LTR_EC = 0x0700, + + /// + /// Sent when the user has changed the edit control direction to right-to-left. The parent window of the edit control receives this + /// notification code through a WM_COMMAND message. + /// + /// Parameters + /// wParam + /// The LOWORD contains the identifier of the edit control. The HIWORD specifies the notification code. + /// lParam + /// A handle to the edit control sending the notification code. + /// + /// + /// If there is a bidirectional language installed on your system, for example, Arabic or Hebrew, you can change the edit control + /// direction using CTRL+LSHIFT (for left to right) and CTRL+RSHIFT (for right to left). + /// + /// Rich Edit: This notification code is not supported. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/en-align-rtl-ec + [MsgParams(typeof(uint), typeof(HWND))] EN_ALIGN_RTL_EC = 0x0701, + + /// EN_BEFORE_PASTE = 0x0800, + + /// EN_AFTER_PASTE = 0x0801, } + + /// Styles for the edit control. + [PInvokeData("Winuser.h", MSDNShortId = "edit_control_constants")] + [Flags] + public enum EditStyle : uint + { + /// Left aligns text. + ES_LEFT = 0x0000, + + /// Centers text in a single-line or multiline edit control. + ES_CENTER = 0x0001, + + /// Right aligns text in a single-line or multiline edit control. + ES_RIGHT = 0x0002, + + /// + /// Designates a multiline edit control. The default is single-line edit control. + /// + /// When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default + /// button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style. + /// + /// + /// When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many + /// lines as possible and scrolls vertically when the user presses the ENTER key. If you do not specify ES_AUTOVSCROLL, the edit + /// control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed. + /// + /// + /// If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past + /// the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the + /// control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user + /// presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping + /// position changes and the text is redisplayed. + /// + /// + /// Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that + /// edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the + /// parent window. + /// + /// + ES_MULTILINE = 0x0004, + + /// + /// Converts all characters to uppercase as they are typed into the edit control. To change this style after the control has been + /// created, use SetWindowLong. + /// + ES_UPPERCASE = 0x0008, + + /// + /// Converts all characters to lowercase as they are typed into the edit control. To change this style after the control has been + /// created, use SetWindowLong. + /// + ES_LOWERCASE = 0x0010, + + /// + /// Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls. + /// + ES_PASSWORD = 0x0020, + + /// Automatically scrolls text up one page when the user presses the ENTER key on the last line. + ES_AUTOVSCROLL = 0x0040, + + /// + /// Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user + /// presses the ENTER key, the control scrolls all text back to position zero. + /// + ES_AUTOHSCROLL = 0x0080, + + /// + /// Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus + /// and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, + /// even if the control does not have the focus. + /// + ES_NOHIDESEL = 0x0100, + + /// + /// Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then + /// back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to + /// convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain file + /// names that will be used on file systems that do not support Unicode. + /// To change this style after the control has been created, use SetWindowLong. + /// + ES_OEMCONVERT = 0x0400, + + /// Prevents the user from typing or editing text in the edit control. + ES_READONLY = 0x0800, + + /// + /// Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit + /// control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog + /// box's default push button. This style has no effect on a single-line edit control. + /// + ES_WANTRETURN = 0x1000, + + /// Allows only digits to be entered into the edit control. + ES_NUMBER = 0x2000, + } + + /// + /// This section lists extended styles used when creating edit controls. The value of extended styles is a bitwise combination of these styles. + /// + // https://learn.microsoft.com/en-us/windows/win32/controls/edit-control-window-extended-styles + [PInvokeData("CommCtrl.h")] + [Flags] + public enum EditStylesEx + { + /// Windows Vista and later. Enables support for carriage return (CR) end-of-line characters to break lines. + ES_EX_ALLOWEOL_CR = 0x0001, + + /// Windows Vista and later. Enables support for linefeed (LF) end-of-line characters to break lines. + ES_EX_ALLOWEOL_LF = 0x0002, + + /// + /// Windows Vista and later. Enables support for both carriage return (CR) and linefeed (LF) end-of-line characters to break lines. + /// + ES_EX_ALLOWEOL_ALL = ES_EX_ALLOWEOL_CR | ES_EX_ALLOWEOL_LF, + + /// + /// Windows Vista and later. Converts end-of-line characters enabled for this edit control in pasted content to match the end-of-line + /// character used by the current document. + /// + ES_EX_CONVERT_EOL_ON_PASTE = 0x0004, + + /// Windows Vista and later. Enables zooming using Ctrl+MouseWheel and the EM_GETZOOM/EM_SETZOOM messages. + ES_EX_ZOOMABLE = 0x0010, + } + + /// + /// Data specific to the status type. If wParam is EMSIS_COMPOSITIONSTRING, this parameter can be one or more of the following values. + /// + [PInvokeData("WinUser.h")] + [Flags] + public enum EIMES + { + /// + /// If this flag is set, the edit control hooks the WM_IME_COMPOSITION message with lParam set to GCS_RESULTSTR and returns the + /// result string immediately. If this flag is not set, the edit control passes the WM_IME_COMPOSITION message to the default window + /// procedure and handles the result string from the WM_CHAR message; this is the default behavior of the edit control. + /// + EIMES_GETCOMPSTRATONCE = 0x0001, + + /// + /// If this flag is set, the edit control cancels the composition string when it receives the WM_SETFOCUS message. If this flag is + /// not set, the edit control does not cancel the composition string; this is the default behavior of the edit control. + /// + EIMES_CANCELCOMPSTRINFOCUS = 0x0002, + + /// + /// If this flag is set, the edit control completes the composition string upon receiving the WM_KILLFOCUS message. If this flag is + /// not set, the edit control does not complete the composition string; this is the default behavior of the edit control. + /// + EIMES_COMPLETECOMPSTRKILLFOCUS = 0x0004, + } + + /// The type of status to set. + [PInvokeData("WinUser.h")] + [Flags] + public enum EMSIS : ushort + { + /// Sets behavior for the handling composition string. + EMSIS_COMPOSITIONSTRING = 0x0001, + } + + /// Word-break constants. + [PInvokeData("winuser.h", MSDNShortId = "NC:winuser.EDITWORDBREAKPROCA")] + public enum WB + { + /// + /// Retrieves the character class and word break flags of the character at the specified position. This value is for use with rich + /// edit controls. + /// + WB_CLASSIFY = 3, + + /// Checks whether the character at the specified position is a delimiter. + WB_ISDELIMITER = 2, + + /// Finds the beginning of a word to the left of the specified position. + WB_LEFT = 0, + + /// Finds the end-of-word delimiter to the left of the specified position. This value is for use with rich edit controls. + WB_LEFTBREAK = 6, + + /// + /// Finds the beginning of a word to the left of the specified position. This value is used during CTRL+LEFT key processing. This + /// value is for use with rich edit controls. + /// + WB_MOVEWORDLEFT = 4, + + /// + /// Finds the beginning of a word to the right of the specified position. This value is used during CTRL+RIGHT key processing. This + /// value is for use with rich edit controls. + /// + WB_MOVEWORDRIGHT = 5, + + /// Finds the beginning of a word to the right of the specified position. This is useful in right-aligned edit controls. + WB_RIGHT = 1, + + /// + /// Finds the end-of-word delimiter to the right of the specified position. This is useful in right-aligned edit controls. This value + /// is for use with rich edit controls. + /// + WB_RIGHTBREAK = 7, + } + + /// Contains information about a balloon tip associated with a button control. + // https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-editballoontip typedef struct _tagEDITBALLOONTIP { DWORD + // cbStruct; LPCWSTR pszTitle; LPCWSTR pszText; INT ttiIcon; } EDITBALLOONTIP, *PEDITBALLOONTIP; + [PInvokeData("commctrl.h", MSDNShortId = "NS:commctrl._tagEDITBALLOONTIP")] + [StructLayout(LayoutKind.Sequential)] + public struct EDITBALLOONTIP + { + /// + /// Type: DWORD + /// A DWORD that contains the size, in bytes, of the structure. + /// + public uint cbStruct; + + /// + /// Type: LPCWSTR + /// A pointer to a Unicode string that contains the title of the balloon tip. + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pszTitle; + + /// + /// Type: LPCWSTR + /// A pointer to a Unicode string that contains the balloon tip text. + /// + [MarshalAs(UnmanagedType.LPWStr)] + public string pszText; + + /// + /// Type: INT + /// + /// A value of type INT that specifies the type of icon to associate with the balloon tip. This member can be one of the + /// following values. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// TTI_ERROR
3
+ /// Use the error icon. + ///
+ /// + /// TTI_INFO + /// Use the information icon. + /// + /// + /// TTI_NONE + /// Use no icon. + /// + /// + /// TTI_WARNING + /// Use the warning icon. + /// + /// + /// TTI_INFO_LARGE + /// Use the large information icon. This is assumed to be an HICON value. + /// + /// + /// TTI_WARNING_LARGE + /// Use the large warning icon. This is assumed to be an HICON value. + /// + /// + /// TTI_ERROR_LARGE + /// Use the large error icon. This is assumed to be an HICON value. + /// + ///
+ ///
+ public int ttiIcon; + + /// Initializes a new instance of the struct. + /// The title. + /// The text. + /// The icon. + public EDITBALLOONTIP(string title, string text, int icon = 0) + { + cbStruct = (uint)Marshal.SizeOf(typeof(EDITBALLOONTIP)); + pszText = text; + pszTitle = title; + ttiIcon = icon; + } + } + + /// Contains information used to handle an EN_SEARCHWEB notification code. + // https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmsearchweb typedef struct NMSEARCHWEB { NMHDR hdr; + // EC_SEARCHWEB_ENTRYPOINT entrypoint; BOOL hasQueryText; BOOL invokeSucceeded; } NMSEARCHWEB; + [PInvokeData("commctrl.h", MSDNShortId = "NS:commctrl.NMSEARCHWEB")] + [StructLayout(LayoutKind.Sequential)] + public struct NMSEARCHWEB : INotificationInfo + { + /// + /// Type: NMHDR + /// An NMHDR structure that contains additional information about this notification. + /// + public NMHDR hdr; + + /// + /// Type: EC_SEARCHWEB_ENTRYPOINT + /// An enum value that indicates the entry point of the search. + /// + public EC_SEARCHWEB_ENTRYPOINT entrypoint; + + /// + /// Type: BOOL + /// TRUE if there is query text; otherwise, FALSE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool hasQueryText; + + /// + /// Type: BOOL + /// TRUE if the invoke succeeded; otherwise, FALSE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool invokeSucceeded; + } } \ No newline at end of file diff --git a/PInvoke/User32/WindowBase.cs b/PInvoke/User32/WindowBase.cs index 197f67f5..fcbf08ae 100644 --- a/PInvoke/User32/WindowBase.cs +++ b/PInvoke/User32/WindowBase.cs @@ -294,6 +294,11 @@ public class WindowBase : MarshalByRefObject, IDisposable, IWindowInstance, IWin /// The return value is the result of the message processing and depends on the message. protected virtual IntPtr WndProc(HWND hwnd, uint msg, IntPtr wParam, IntPtr lParam) => DefWndProc(hwnd, msg, wParam, lParam); + /// Performs an implicit conversion from to . + /// The instance. + /// The result of the conversion. + public static implicit operator HWND(WindowBase w) => w.Handle; + [DebuggerStepThrough] private void CheckDetached() { diff --git a/UnitTests/PInovke/MsftEdit/MsftEdit.csproj b/UnitTests/PInovke/MsftEdit/MsftEdit.csproj new file mode 100644 index 00000000..d0947625 --- /dev/null +++ b/UnitTests/PInovke/MsftEdit/MsftEdit.csproj @@ -0,0 +1,19 @@ + + + UnitTest.PInvoke.MsftEdit + + + + tlbimp + 0 + 1 + 930299ce-9965-4dec-b0f4-a54848d4b667 + 0 + false + true + + + + + + \ No newline at end of file diff --git a/UnitTests/PInovke/MsftEdit/MsftEditTests.cs b/UnitTests/PInovke/MsftEdit/MsftEditTests.cs new file mode 100644 index 00000000..05d26ac2 --- /dev/null +++ b/UnitTests/PInovke/MsftEdit/MsftEditTests.cs @@ -0,0 +1,71 @@ +using NUnit.Framework; +using NUnit.Framework.Internal; +using System; +using System.Runtime.InteropServices; +using static Vanara.PInvoke.Kernel32; +using static Vanara.PInvoke.User32; +using static Vanara.PInvoke.MsftEdit; +using System.Threading; +using System.Collections.Generic; +using static Vanara.PInvoke.Macros; +using System.Text; +using Vanara.InteropServices; + +namespace Vanara.PInvoke.Tests; +[TestFixture] +public class MsftEditTests +{ + [OneTimeSetUp] + public void _Setup() + { + MsftEditThreadInit(); + } + + [OneTimeTearDown] + public void _TearDown() + { + } + + [Test] + public void IRichEditOleTest() + { + SafeHWND hEdit = null; + VisibleWindow.Run(WndProc, System.Reflection.MethodBase.GetCurrentMethod().Name); + + IntPtr WndProc(HWND hwnd, uint msg, IntPtr wParam, IntPtr lParam) + { + System.Diagnostics.Debug.WriteLine($"TestWndProc={(WindowMessage)msg}"); + try + { + switch (msg) + { + case (uint)WindowMessage.WM_CREATE: + GetClientRect(hwnd, out var rc); + hEdit = CreateWindowEx(0, MSFTEDIT_CLASS, "Type here.", (WindowStyles)EditStyle.ES_MULTILINE | WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD | WindowStyles.WS_BORDER | WindowStyles.WS_TABSTOP, 0, 0, rc.Width, rc.Height, hwnd); + IRichEditOle iEdit = RichEdit_GetOleInterface(hEdit); + Assert.That(iEdit, Is.Not.Null); + Assert.That(iEdit.GetLinkCount(), Is.Zero); + ITextDocument2 iDoc = iEdit as ITextDocument2; + Assert.That(iDoc, Is.Not.Null); + Assert.That(iDoc.GetDefaultTabStop(), Is.Not.Zero); + iDoc.Open(TestCaseSources.TempDirWhack + "Test.rtf"); + Assert.That(iDoc.GetName(), Is.SamePath(TestCaseSources.TempDirWhack + "Test.rtf")); + Assert.That(iDoc.GetSaved(), Is.EqualTo(tomConstants.tomTrue)); + var iFont = iDoc.GetDocumentFont(); + Assert.That(iFont, Is.Not.Null); + TestContext.WriteLine($"Font: {iFont.GetName()}, {iFont.GetSize()}, {iFont.GetForeColor():X}"); + break; + case (uint)WindowMessage.WM_SIZE: + if (hEdit is not null) + MoveWindow(hEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), true); + return default; + } + } + catch (Exception ex) + { + TestContext.Error.WriteLine(ex.ToString()); + } + return DefWindowProc(hwnd, msg, wParam, lParam); + } + } +} \ No newline at end of file diff --git a/Vanara.sln b/Vanara.sln index ba09879a..c493f600 100644 --- a/Vanara.sln +++ b/Vanara.sln @@ -419,7 +419,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.Avrt", "PInv EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lz32", "UnitTests\PInvoke\Lz32\Lz32.csproj", "{3A6782D5-E72D-4546-81D6-EBA19A08D9E3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vanara.PInvoke.MsftEdit", "PInvoke\MsftEdit\Vanara.PInvoke.MsftEdit.csproj", "{C62629F4-BA1F-4E21-B253-55864BDA0200}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.MsftEdit", "PInvoke\MsftEdit\Vanara.PInvoke.MsftEdit.csproj", "{C62629F4-BA1F-4E21-B253-55864BDA0200}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsftEdit", "UnitTests\PInovke\MsftEdit\MsftEdit.csproj", "{BD978D87-063B-461F-9ECB-B67F962F54D6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.UIAutomation", "PInvoke\UIAutomation\Vanara.PInvoke.UIAutomation.csproj", "{7729B4B9-4837-49D5-91CC-5BB66E23A376}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -3689,6 +3693,42 @@ Global {C62629F4-BA1F-4E21-B253-55864BDA0200}.Release|x64.Build.0 = Release|x64 {C62629F4-BA1F-4E21-B253-55864BDA0200}.Release|x86.ActiveCfg = Release|x86 {C62629F4-BA1F-4E21-B253-55864BDA0200}.Release|x86.Build.0 = Release|x86 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Debug|x64.ActiveCfg = Debug|x64 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Debug|x64.Build.0 = Debug|x64 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Debug|x86.ActiveCfg = Debug|x86 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Debug|x86.Build.0 = Debug|x86 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.DebugNoTests|Any CPU.ActiveCfg = DebugNoTests|Any CPU + {BD978D87-063B-461F-9ECB-B67F962F54D6}.DebugNoTests|Any CPU.Build.0 = DebugNoTests|Any CPU + {BD978D87-063B-461F-9ECB-B67F962F54D6}.DebugNoTests|x64.ActiveCfg = DebugNoTests|x64 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.DebugNoTests|x64.Build.0 = DebugNoTests|x64 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.DebugNoTests|x86.ActiveCfg = DebugNoTests|x86 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.DebugNoTests|x86.Build.0 = DebugNoTests|x86 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Release|Any CPU.Build.0 = Release|Any CPU + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Release|x64.ActiveCfg = Release|x64 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Release|x64.Build.0 = Release|x64 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Release|x86.ActiveCfg = Release|x86 + {BD978D87-063B-461F-9ECB-B67F962F54D6}.Release|x86.Build.0 = Release|x86 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Debug|x64.ActiveCfg = Debug|x64 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Debug|x64.Build.0 = Debug|x64 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Debug|x86.ActiveCfg = Debug|x86 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Debug|x86.Build.0 = Debug|x86 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.DebugNoTests|Any CPU.ActiveCfg = Debug|Any CPU + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.DebugNoTests|Any CPU.Build.0 = Debug|Any CPU + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.DebugNoTests|x64.ActiveCfg = Debug|x64 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.DebugNoTests|x64.Build.0 = Debug|x64 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.DebugNoTests|x86.ActiveCfg = Debug|x86 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.DebugNoTests|x86.Build.0 = Debug|x86 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Release|Any CPU.Build.0 = Release|Any CPU + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Release|x64.ActiveCfg = Release|x64 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Release|x64.Build.0 = Release|x64 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Release|x86.ActiveCfg = Release|x86 + {7729B4B9-4837-49D5-91CC-5BB66E23A376}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3878,6 +3918,8 @@ Global {20C67C75-BCD0-4AFC-8C69-32C11450D7FA} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} {3A6782D5-E72D-4546-81D6-EBA19A08D9E3} = {385CAD2D-0A5E-4F80-927B-D5499D126B90} {C62629F4-BA1F-4E21-B253-55864BDA0200} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} + {BD978D87-063B-461F-9ECB-B67F962F54D6} = {385CAD2D-0A5E-4F80-927B-D5499D126B90} + {7729B4B9-4837-49D5-91CC-5BB66E23A376} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}