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; public static partial class MsftEdit { /// The type of change that occurred. [PInvokeData("textserv.h", MSDNShortId = "NS:textserv.CHANGENOTIFY")] [Flags] public enum CN : uint { /// No significant change occurred. CN_GENERIC = 0, /// The text changed. CN_TEXTCHANGED = 1, /// A new undo action was added. CN_NEWUNDO = 2, /// A new redo action was added. CN_NEWREDO = 4, } /// Indicates the edit style flags to retrieve. [PInvokeData("textserv.h")] [Flags] public enum TXES : uint { /// Indicates that the host of the rich edit control is a dialog box. TXES_ISDIALOG = 0x00000001 } /// A variable that the text host sets to indicate the background style. [PInvokeData("textserv.h")] public enum TXTBACKSTYLE { /// Background shows through. TXTBACK_TRANSPARENT = 0, /// Background does not show through. TXTBACK_OPAQUE, } /// Bits representing properties to be changed or their flags. [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextServices")] [Flags] public enum TXTBIT : uint { /// Show last password char momentarily TXTBIT_FLASHLASTPASSWORDCHAR = 0x10000000, /// Use advanced input features. TXTBIT_ADVANCEDINPUT = 0x20000000, /// If TRUE, beeping is enabled. TXTBIT_ALLOWBEEP = 0x800, /// If TRUE, the AutoWordSelect feature is enabled. TXTBIT_AUTOWORDSEL = 0x80, /// If TRUE, the backstyle changed. See TxGetBackStyle. TXTBIT_BACKSTYLECHANGE = 0x4000, /// If TRUE, the character format changed. TXTBIT_CHARFORMATCHANGE = 0x20000, /// If TRUE, the client rectangle changed. TXTBIT_CLIENTRECTCHANGE = 0x100000, /// If TRUE, dragging is disabled. TXTBIT_DISABLEDRAG = 0x1000, /// Use Direct2D/DirectWrite for this instance, and not GDI/Uniscribe. TXTBIT_D2DDWRITE = 0x1000000, /// Render glyphs to the nearest pixel positions. Valid only if D2DDWRITE is set. TXTBIT_D2DPIXELSNAPPED = 0x4000000, /// /// Draw lines with subpixel precision. Don't pixel-snap text lines, underline, and strikethrough in the secondary text flow /// direction (usually vertical). Valid only if D2DDWRITE is set and D2DPIXELSNAPPED is not set. /// TXTBIT_D2DSUBPIXELLINES = 0x8000000, /// Render text using simple typography (no glyph rendering). This value is valid only if TXTBIT_D2DDWRITE is also specified. TXTBIT_D2DSIMPLETYPOGRAPHY = 0x2000000, /// If TRUE, the size of the client rectangle changed. TXTBIT_EXTENTCHANGE = 0x80000, /// /// If TRUE, the text services object should hide the selection when the control is inactive. If FALSE, the selection should be /// displayed when the control is inactive. /// Note, this implies TXTBIT_SAVESELECTION is TRUE. /// TXTBIT_HIDESELECTION = 0x20, /// If TRUE, the maximum length for text in the control changed. TXTBIT_MAXLENGTHCHANGE = 0x8000, /// /// If TRUE, the text services object should work in multiline mode. Use the TXTBIT_WORDWRAP value to determine whether to wrap the /// lines to the view rectangle or clip them. /// /// If FALSE, the text services object should not process a carriage return/line feed from the ENTER key and it should truncate /// incoming text containing hard line breaks just before the first line break. It is also acceptable to truncate text that is set /// with ITextServices::TxSetText, because it is the responsibility of the host not to use a single-line control when bound to a /// multiline field. /// /// TXTBIT_MULTILINE = 2, /// Don't reference TLS data on behalf of this instance. TXTBIT_NOTHREADREFCOUNT = 0x400000, /// If TRUE, the paragraph format changed. TXTBIT_PARAFORMATCHANGE = 0x40000, /// /// If TRUE, the text services object should not accept any editing change through the user interface. However, it should still /// accept programmatic changes through EM_SETTEXTEX, EM_REPLACESEL, and ITextServices::TxSetText. Also, the user should still be /// able to move the insertion point, select text, and carry out other operations that don't modify content, such as Copy. /// TXTBIT_READONLY = 4, /// /// If TRUE, the text services object should be in rich-text mode. /// If FALSE, it is in plain-text mode. /// /// Note, this affects how editing commands are applied. For example, applying bold to part of the text in a plain-edit control makes /// the entire text bold. However, for a rich-edit control, this makes only the selected text bold. /// /// TXTBIT_RICHTEXT = 1, /// /// If TRUE, the boundaries of the selection should be saved when the control is inactive. /// If FALSE, when the control goes active again the selection boundaries can be reset to start = 0, length = 0. /// TXTBIT_SAVESELECTION = 0x40, /// If TRUE, the scroll bar has changed. TXTBIT_SCROLLBARCHANGE = 0x10000, /// If TRUE, the selection bar width has changed TXTBIT_SELBARCHANGE = 0x200, /// /// If set, the accelerator character should be underlined. /// This must be set in order to call TxGetAcceleratorPos. /// TXTBIT_SHOWACCELERATOR = 8, /// Show password strings. TXTBIT_SHOWPASSWORD = 0x800000, /// Not supported. TXTBIT_USECURRENTBKG = 0x200000, /// /// If TRUE, display text using the password character obtained by TxGetPasswordChar. /// /// The notification on this property can mean either that the password character changed or that the password character was not used /// before but is used now (or vice versa). /// /// TXTBIT_USEPASSWORD = 0x10, /// Not supported. TXTBIT_VERTICAL = 0x100, /// If TRUE, the inset changed. TXTBIT_VIEWINSETCHANGE = 0x2000, /// /// If TRUE and TXTBIT_MULTILINE is also TRUE, multiline controls should wrap the line to the view rectangle. If this property is /// FALSE and TXTBIT_MULTILINE is TRUE, the lines should not be wrapped but clipped. The right side of the view rectangle should be ignored. /// If TXTBIT_MULTILINE is FALSE, this property has no effect. /// TXTBIT_WORDWRAP = 0x400, } /// The type of fitting requested. [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextServices")] [Flags] public enum TXTNATURALSIZE : uint { /// Resize the control so that it fits indented content. TXTNS_FITTOCONTENT2 = 0, /// /// Resize the control to fit the entire text by formatting the text to the width that is passed in. The text services object returns /// the height of the entire text and the width of the widest line. For example, this should be done when the user double-clicks one /// of the control's handles. /// TXTNS_FITTOCONTENT = 1, /// /// Resize the control to show an integral number of lines (no line is clipped). Format enough text to fill the width and height that /// is passed in, and then return a height that is rounded to the nearest line boundary. /// /// The passed and returned width and height correspond to the view rectangle. The host should adjust back to the /// client rectangle as needed. Because these values represent the extent of the text object, they are input and output in HIMETRIC /// coordinates (each HIMETRIC unit is .01 millimeter), and measuring does not include any zoom factor. For a discussion of the zoom /// factor, see TxGetExtent. /// /// TXTNS_ROUNDTOLINE = 2, /// Resize the control so that it fits indented content and trailing whitespace. TXTNS_FITTOCONTENT3 = 3, /// Resize the control so that it fits unindented content and trailing whitespace. TXTNS_FITTOCONTENTWSP = 4, /// For a plain-text control, include the height of the final carriage return when calculating the size. TXTNS_INCLUDELASTLINE = 0x40000000, /// Use English Metric Units (EMUs) instead of pixels as the measuring units for this method's parameters. TXTNS_EMU = 0x80000000, } /// Specifies the view to draw. [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextServices")] public enum TXTVIEW { /// Draw the inplace active view. TXTVIEW_ACTIVE = 0, /// Draw a view other than the inplace active view; for example, a print preview. TXTVIEW_INACTIVE = 1, } /* /// Provides Microsoft UI Automation accessibility information about a windowless rich edit control. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nn-textserv-irichedituiainformation [PInvokeData("textserv.h", MSDNShortId = "NN:textserv.IRichEditUiaInformation")] [ComImport, Guid(""), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IRichEditUiaInformation { /// Retrieves the bounding rectangle of a windowless rich edit control. /// /// Type: UiaRect* /// The bounding rectangle, in screen coordinates. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-irichedituiainformation-getboundaryrectangle HRESULT // GetBoundaryRectangle( UiaRect *pUiaRect ); [PreserveSig] HRESULT GetBoundaryRectangle(out UiaRect pUiaRect); /// Indicates whether a windowless rich edit control is currently visible. /// /// Type: HRESULT /// Returns S_OK if the windowless rich edit control is visible, or S_FALSE otherwise. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-irichedituiainformation-isvisible HRESULT IsVisible(); [PreserveSig] HRESULT IsVisible(); } */ /// /// Enables the host container of a windowless rich edit control to override the control's Microsoft UI Automation accessibility properties. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nn-textserv-irichedituiaoverrides [PInvokeData("textserv.h", MSDNShortId = "NN:textserv.IRicheditUiaOverrides")] [ComImport, Guid("F2FB5CC0-B5A9-437F-9BA2-47632082269F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IRicheditUiaOverrides { /// /// Retrieves the host container's override value for the specified Microsoft UI Automation accessibility property of a windowless /// rich edit control. /// /// /// Type: PROPERTYID /// The identifier of the property to retrieve. /// /// /// Type: VARIANT* /// The host container's override value for the propertyId property. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-irichedituiaoverrides-getpropertyoverridevalue HRESULT // GetPropertyOverrideValue( PROPERTYID propertyId, VARIANT *pRetValue ); [PreserveSig] HRESULT GetPropertyOverrideValue(int /*PROPERTYID*/ propertyId, out object pRetValue); } /// /// Enables the host container of a windowless rich edit control to obtain the Microsoft UI Automation provider for the parent of the control. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nn-textserv-iricheditwindowlessaccessibility [PInvokeData("textserv.h", MSDNShortId = "NN:textserv.IRicheditWindowlessAccessibility")] [ComImport, Guid("983E572D-20CD-460B-9104-83111592DD10"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IRicheditWindowlessAccessibility { /// Obtains a Microsoft UI Automation provider object for the parent of a windowless rich edit control. /// /// Type: IRawElementProviderWindowlessSite* /// The ActiveX control site that hosts the windowless rich edit control. /// /// /// Type: IRawElementProviderSimple** /// The UI Automation provider for the windowless rich edit control's parent. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-iricheditwindowlessaccessibility-createprovider HRESULT // CreateProvider( IRawElementProviderWindowlessSite *pSite, IRawElementProviderSimple **ppProvider ); [PreserveSig] HRESULT CreateProvider(IRawElementProviderWindowlessSite pSite, out IRawElementProviderSimple ppProvider); } /// The ITextHost interface is used by a text services object to obtain text host services. /// /// You must implement the ITextHost interface before you call the CreateTextServices function. /// /// Applications do not call the ITextHost methods. A text services object created by the CreateTextServices function calls the /// interface methods. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nl-textserv-itexthost [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextHost")] [ComVisible(true), Guid("13E670F4-1A5A-11CF-ABEB-00AA00B65EA1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITextHost { /// Sets the default character format for the text host. /// /// Type: const CHARFORMAT* /// The new default-character format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return one of the following COM error codes if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_FAIL /// Unspecified error. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-ontxcharformatchange HRESULT // OnTxCharFormatChange( [in] const CHARFORMATW *pCF ); [PreserveSig] HRESULT OnTxCharFormatChange(in CHARFORMAT pCF); /// Sets the default paragraph format for the text host. /// /// Type: const PARAFORMAT* /// The new default paragraph format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return one of the following COM error codes if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_FAIL /// Unspecified error. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-ontxparaformatchange HRESULT // OnTxParaFormatChange( [in] const PARAFORMAT *pPF ); [PreserveSig] HRESULT OnTxParaFormatChange(in PARAFORMAT pPF); /// Notifies the text host that the control is active. /// /// Type: LONG* /// The previous activation state. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Activation is not possible at this time. /// /// /// /// /// It is legal for the host to refuse an activation request; for example, the control may be minimized and thus invisible. /// The caller should be able to gracefully handle failure to activate. /// No matter how many times this method is called, only one ITextHost::TxDeactivate call is necessary to deactivate the control. /// /// This function returns an opaque handle in plOldState. The caller (the text services object) should save this handle and /// use it in a subsequent call to ITextHost::TxDeactivate. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txactivate HRESULT TxActivate( LONG *plOldState ); [PreserveSig] HRESULT TxActivate(out int plOldState); /// Converts text host coordinates to screen coordinates. /// /// Type: LPPOINT /// The client coordinates to convert. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// /// /// This call is valid at any time, although it is allowed to fail. In general, if the text services object needs to translate from /// client coordinates (for example, for the TOM GetPoint method) the text services object is visible. /// /// However, if no conversion is possible, then the method fails. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txclienttoscreen BOOL TxClientToScreen( [in] // LPPOINT lppt ); [PreserveSig] bool TxClientToScreen(in POINT lppt); /// Creates a new shape for windowless rich edit control's caret. /// /// Type: HBITMAP /// Handle to the bitmap for the new caret shape. /// If the windowless rich edit control has the SES_LOGICALCARET style, hbmp is a combination of the following values: /// /// /// Value /// Meaning /// /// /// CARET_CUSTOM /// An adorned caret. This value is valid only if CARET_RTL is also specified. /// /// /// CARET_ITALIC /// An italicized caret. /// /// /// CARET_NONE /// A blinking vertical bar. /// /// /// CARET_NULL /// An empty bitmap (for non-degenerate text selection). /// /// /// CARET_ROTATE90 /// A caret that is rotated clockwise by 90 degrees. /// /// /// CARET_RTL /// The caret moves right to left. /// /// /// /// /// Type: INT /// Caret width, in logical units. /// /// /// Type: INT /// Caret height, in logical units. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txcreatecaret BOOL TxCreateCaret( [in] HBITMAP // hbmp, [in] INT xWidth, [in] INT yHeight ); [PreserveSig] bool TxCreateCaret([In] HBITMAP hbmp, int xWidth, int yHeight); /// Notifies the text host that the control is now inactive. /// /// Type: LONG /// New state of the control. Typically it is the value returned by ITextHost::TxActivate. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unspecified error. /// /// /// /// /// No matter how many times this method is called, only one call to ITextHost::TxActivate is necessary to activate the control. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txdeactivate HRESULT TxDeactivate( LONG // lNewState ); [PreserveSig] HRESULT TxDeactivate(int lNewState); /// Enables or disables one or both scroll bar arrows in the text host window. /// /// Type: INT /// Specifies which scroll bar is affected. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// SB_BOTH /// Affects both the horizontal and vertical scroll bars. /// /// /// SB_HORZ /// Affects the horizontal scroll bar. /// /// /// SB_VERT /// Affects the vertical scroll bar. /// /// /// /// /// Type: INT /// Specifies which scroll bar arrows are enabled or disabled. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// ESB_DISABLE_BOTH /// Disables both arrows on a scroll bar. /// /// /// ESB_DISABLE_DOWN /// Disables the down arrow on a vertical scroll bar. /// /// /// ESB_DISABLE_LEFT /// Disables the left arrow on a horizontal scroll bar. /// /// /// ESB_DISABLE_LTUP /// Disables the left arrow on a horizontal scroll bar or the up arrow of a vertical scroll bar. /// /// /// ESB_DISABLE_RIGHT /// Disables the right arrow on a horizontal scroll bar. /// /// /// ESB_DISABLE_RTDN /// Disables the right arrow on a horizontal scroll bar or the down arrow of a vertical scroll bar. /// /// /// ESB_DISABLE_UP /// Disables the up arrow on a vertical scroll bar. /// /// /// ESB_ENABLE_BOTH /// Enables both arrows on a scroll bar. /// /// /// /// /// Type: BOOL /// Return nonzero if the arrows are enabled or disabled as specified. /// Return zero if the arrows are already in the requested state or an error occurs. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txenablescrollbar BOOL TxEnableScrollBar( [in] // INT fuSBFlags, [in] INT fuArrowflags ); [PreserveSig] bool TxEnableScrollBar(SB fuSBFlags, ESB_FLAGS fuArrowflags); /// Requests the special character to use for the underlining accelerator character. /// /// Type: LONG* /// /// The character position of the character to underline. This variable is set by the text host. A character position of –1 (that /// is, negative one) indicates that no character should be underlined. /// /// /// /// Type: HRESULT /// The return value is S_OK. /// /// /// /// Accelerators allow keyboard shortcuts, or accelerator keys, to various UI elements (such as buttons). Typically, the shortcut /// character is underlined. /// /// /// This method tells the text services object which character is the accelerator and thus should be underlined. Note that the text /// services object does not process accelerators; that is the responsibility of the host. /// /// This method is typically only called if the TXTBIT_SHOWACCELERATOR bit is set in the text services object. See OnTxPropertyBitsChange. /// /// Note   Any change to the text in the text services object results in the invalidation of the accelerator /// underlining. In this case, it is the host's responsibility to recalculate the appropriate character position and inform the text /// services object that a new accelerator is available. /// ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetacceleratorpos HRESULT // TxGetAcceleratorPos( LONG *pcp ); [PreserveSig] HRESULT TxGetAcceleratorPos(out int pcp); /// Requests the background style of the text host. /// /// Type: TXTBACKSTYLE* /// /// A variable that the text host sets to indicate the background style. The style is one of the following values from the /// TXTBACKSTYLE enumeration. /// /// /// /// Value /// Meaning /// /// /// TXTBACK_TRANSPARENT /// Background shows through. /// /// /// TXTBACK_OPAQUE /// Background does not show through. /// /// /// /// /// Type: HRESULT /// The return value is S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetbackstyle HRESULT TxGetBackStyle( // TXTBACKSTYLE *pstyle ); [PreserveSig] HRESULT TxGetBackStyle(out TXTBACKSTYLE pstyle); /// Requests the text host's default character format. /// /// Type: const CHARFORMAT** /// The default character format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// The text host retains ownership of the CHARFORMAT returned. However, the pointer returned must remain valid until the text host /// notifies the text services object through OnTxPropertyBitsChange that the default character format has changed. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetcharformat HRESULT TxGetCharFormat( const // CHARFORMATW **ppCF ); [PreserveSig] HRESULT TxGetCharFormat(out IntPtr /* CHARFORMATW* */ ppCF); /// Retrieves the client coordinates of the text host's client area. /// /// Type: LPRECT /// The client coordinates of the text host's client area. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unspecified error. /// /// /// /// /// /// The client rectangle is the rectangle that the text services object is responsible for painting and managing. The host relies on /// the text services object for painting that area. And, the text services object must not paint or invalidate areas outside of that rectangle. /// /// The host forwards mouse messages to the text services object when the cursor is over the client rectangle. /// The client rectangle is expressed in client coordinates of the containing window. /// Important   The ITextHost::TxGetClientRect method will fail if called at an inactive time. ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetclientrect HRESULT TxGetClientRect( LPRECT // prc ); [PreserveSig] HRESULT TxGetClientRect(out RECT prc); /// Requests the device context for the text host window. /// /// Type: HDC /// If the method succeeds, return the handle of the device context for the client area of the text host window. /// If the method fails, return NULL. For more information on COM error codes, see Error Handling in COM. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetdc HDC TxGetDC(); [PreserveSig] HDC TxGetDC(); /// Requests the native size of the control in HIMETRIC. /// /// Type: LPSIZEL /// The size of the control in HIMETRIC, that is, where the unit is .01 millimeter. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// /// This method is used by the text services object to implement zooming. The text services object derives the zoom factor from the /// ratio between the himetric and device pixel extent of the client rectangle. Each HIMETRIC unit corresponds to 0.01 millimeter. /// /// /// [vertical zoom factor] = [pixel height of the client rect] * 2540 / [HIMETRIC vertical extent] * [pixel per vertical inch (from /// device context)] /// /// /// If the vertical and horizontal zoom factors are not the same, the text services object can ignore the horizontal zoom factor and /// assume it is the same as the vertical one. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetextent HRESULT TxGetExtent( LPSIZEL // lpExtent ); [PreserveSig] HRESULT TxGetExtent(out SIZE lpExtent); /// Gets the text host's maximum allowed length for the text. /// /// Type: DWORD* /// /// The maximum allowed text length, in number of characters. If INFINITE is returned, the text services object can use as much /// memory as needed to store any specified text. /// /// /// /// Type: HRESULT /// The return value is S_OK. /// /// /// /// When this maximum is reached, the text services object should reject any further character insertion and pasted text. TxSetText /// however should still accept (and set) text longer than the maximum length. This is because this method is used for binding and is /// critical to maintaining the integrity of the data to which the control is bound. /// /// This method parallels the EM_LIMITTEXT message. /// /// If the limit returned is less than the number of characters currently in the text services object, no data is lost. Instead, no /// edits are allowed to the text other than deletion until the text is reduced to below the limit. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetmaxlength HRESULT TxGetMaxLength( DWORD // *plength ); [PreserveSig] HRESULT TxGetMaxLength(out uint plength); /// Requests the text host's default paragraph format. /// /// Type: const PARAFORMAT** /// The default paragraph format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// The host object retains ownership of the PARAFORMAT structure that is returned. However, the pointer returned must remain valid /// until the host notifies the text services object, through OnTxPropertyBitsChange, that the default paragraph format has changed. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetparaformat HRESULT TxGetParaFormat( const // PARAFORMAT **ppPF ); [PreserveSig] HRESULT TxGetParaFormat(out IntPtr /* PARAFORMAT* */ ppPF); /// Requests the text host's password character. /// /// Type: TCHAR* /// The password character. /// /// /// Type: HRESULT /// Return S_OK if the password character is enabled. /// /// Return S_FALSE if the password character is not enabled. For more information on COM error codes, see Error Handling in COM. /// /// /// /// The password character is only shown if the TXTBIT_USEPASSWORD bit is enabled in the text services object. If the password /// character changes, re-enable the TXTBIT_USEPASSWORD bit through OnTxPropertyBitsChange. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetpasswordchar HRESULT TxGetPasswordChar( // [out] TCHAR *pch ); [PreserveSig] HRESULT TxGetPasswordChar([MarshalAs(UnmanagedType.LPTStr)] out char pch); /// Requests the bit property settings for the text host. /// /// Type: DWORD /// Mask of properties in which the caller is interested. For the possible bit values, see dwBits in OnTxPropertyBitsChange. /// /// /// Type: DWORD* /// The current settings for the properties specified by dwMask. /// /// /// Type: HRESULT /// The return value is S_OK. /// /// This call is valid at any time, for any combination of requested property bits. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetpropertybits HRESULT TxGetPropertyBits( // [in] DWORD dwMask, [in] DWORD *pdwBits ); [PreserveSig] HRESULT TxGetPropertyBits(TXTBIT dwMask, out TXTBIT pdwBits); /// Requests information about the scroll bars supported by the text host. /// /// Type: DWORD* /// The scroll bar. This parameter can be a combination of the following window styles related to scroll bars. /// /// /// Value /// Meaning /// /// /// /// Supports a vertical scroll bar. /// /// /// /// Supports a horizontal scroll bar. /// /// /// /// Automatically scrolls text up one page when the user presses ENTER on the last line. /// /// /// /// /// 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 ENTER, the control scrolls all text back to position zero. /// /// /// /// /// Disables scroll bars instead of hiding them when they are not needed. /// /// /// /// /// Type: HRESULT /// The return value is S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetscrollbars HRESULT TxGetScrollBars( DWORD // *pdwScrollBar ); [PreserveSig] HRESULT TxGetScrollBars(out uint pdwScrollBar); /// Returns the size of selection bar in HIMETRIC. /// /// Type: LONG* /// The width, in HIMETRIC (that is, where the units are .01 millimeter), of the selection bar. /// /// /// Type: HRESULT /// The return value is S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetselectionbarwidth HRESULT // TxGetSelectionBarWidth( LONG *lSelBarWidth ); [PreserveSig] HRESULT TxGetSelectionBarWidth(out int lSelBarWidth); /// Retrieves the text host's color for a specified display element. /// /// Type: INT /// /// The display element whose color is to be retrieved. For a list of possible values for this parameter, see the GetSysColor function. /// /// /// /// Type: COLORREF /// The value that identifies the red, green, and blue (RGB) color value of the specified element. /// /// /// /// Note that the color returned may be different than the color that would be returned from a call to GetSysColor. This is /// the case if the host overrides the default system behavior. /// /// /// Note   Hosts should be careful about overriding normal system behavior because it can result in inconsistent UI /// (particularly with respect to Accessibility options). /// ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetsyscolor COLORREF TxGetSysColor( [in] int // nIndex ); [PreserveSig] COLORREF TxGetSysColor(int nIndex); /// Requests the dimensions of the white space inset around the text in the text host window. /// /// Type: LPRECT /// /// The inset size, in client coordinates. The top, bottom, left, and right members of the RECT structure indicate how far in each /// direction the drawing should be inset. /// /// /// /// Type: HRESULT /// The return value is S_OK. /// /// /// /// The view inset is the amount of space on each side between the client rectangle and the view rectangle. The view rectangle (also /// called the Formatting rectangle) is the rectangle in which the text should be formatted . /// /// /// The view insets are passed in a RECT structure, but this is not really a rectangle. It should be treated as four independent /// values to subtract on each side of the client rectangle to figure the view rectangle. /// /// /// The view insets are passed in HIMETRIC (each HIMETRIC unit corresponds to 0.01 millimeter) so that they do not depend on the /// client rectangle and the rendering device context. /// /// /// View insets can be negative on either side of the client rectangle, leading to a bigger view rectangle than the client rectangle. /// The text should then be clipped to the client rectangle. If the view rectangle is wider than the client rectangle, then the host /// may add a horizontal scroll bar to the control. /// /// Single line–text services objects ignore the right boundary of the view rectangle when formatting text. /// The view inset is available from the host at all times, active or inactive. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetviewinset HRESULT TxGetViewInset( LPRECT // prc ); [PreserveSig] HRESULT TxGetViewInset(out RECT prc); /// /// Retrieves the Input Method Editor (IME) input context associated with the text services host. /// This method is used only in Asian-language versions of the operating system. /// /// /// Type: HIMC /// The handle to the input context. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-tximmgetcontext HIMC TxImmGetContext(); [PreserveSig] HIMC TxImmGetContext(); /// /// /// Releases an input context returned by the ITextHost::TxImmGetContext method and unlocks the memory associated with the context. /// /// This method is used only in Asian-language versions of the operating system. /// /// /// Type: HIMC /// The input context. /// /// None // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-tximmreleasecontext void TxImmReleaseContext( // [in] HIMC himc ); [PreserveSig] void TxImmReleaseContext([In] HIMC himc); /// Specifies a rectangle for the text host to add to the update region of the text host window. /// /// Type: LPCRECT /// The invalid rectangle. /// /// /// Type: BOOL /// /// Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter /// is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the /// background remains unchanged. /// /// /// None /// /// This function may be called while inactive; however, the host implementation is free to invalidate an area greater than the /// requested RECT. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txinvalidaterect void TxInvalidateRect( [in] // LPCRECT prc, [in] BOOL fMode ); [PreserveSig] void TxInvalidateRect(in RECT prc, bool fMode); /// Requests the text host to destroy the specified timer. /// /// Type: UINT /// Identifier of the timer created by the ITextHost::TxSetTimer method. /// /// None /// This method may be called at any time, whether the control is active or inactive. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txkilltimer void TxKillTimer( [in] UINT idTimer ); [PreserveSig] void TxKillTimer(uint idTimer); /// Notifies the text host of various events. /// /// Type: DWORD /// Event to notify host of. One of the EN_ notification codes. /// /// /// Type: void* /// Extra data, dependent on iNotify. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// Return S_FALSE if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Note that there are two basic categories of events, direct and delayed . Direct events are sent immediately because /// they need some processing, for example, EN_PROTECTED. Delayed events are sent after all processing has occurred; the control is /// thus in a stable state. Examples of delayed notifications are EN_CHANGE, EN_ERRSPACE, and EN_SELCHANGE. /// /// /// The notification events are the same as the notification codes sent to the parent window of a rich edit window. The firing of /// events may be controlled with a mask set through the EM_SETEVENTMASK message. /// /// /// In general, it is legal to make calls to the text services object while processing this method; however, implementers are /// cautioned to avoid excessive recursion. /// /// The following is a list of the notifications that may be sent. /// /// /// Notification /// Meaning /// /// /// EN_CHANGE /// /// Sent after the system updates the screen, when the user takes an action that may have altered text in the control. /// /// /// /// EN_DROPFILES /// Sent when either a WM_DROPFILES message or an IDropTarget::DragEnter notification is received. /// /// /// EN_ERRSPACE /// Sent when a control cannot allocate enough memory to meet a specified request. /// /// /// EN_HSCROLL /// Sent when the user clicks the control's horizontal scroll bar before the screen is updated. /// /// /// EN_KILLFOCUS /// Sent when the control loses the keyboard focus. /// /// /// EN_LINK /// /// Sent when a rich edit control receives various messages, such as mouse click messages, when the mouse pointer is over text that /// has the CFE_LINK effect. /// /// /// /// EN_MAXTEXT /// Sent when the current text insertion has exceeded the maximum number of characters for the control. /// /// /// EN_OLEOPFAILED /// Sent when a user action on an OLE object has failed. /// /// /// EN_PROTECTED /// Sent when the user takes an action that changes the protected range of text. /// /// /// EN_REQUESTRESIZE /// Sent when a rich edit control's contents are different from the control's window size. /// /// /// EN_SAVECLIPBOARD /// /// Sent when an edit control is being destroyed. The text host should indicate whether OleFlushClipboard should be called. Data /// indicating the number of characters and objects to be flushed is sent in the ENSAVECLIPBOARD data structure. Mask value is nothing. /// /// /// /// EN_SELCHANGE /// /// Sent when the current selection has changed. A SELCHANGE data structure is also sent, which indicates the new selection range at /// the type of data the selection is currently over. Controlled through the ENM_SELCHANGE mask. /// /// /// /// EN_SETFOCUS /// Sent when the edit control receives the keyboard focus. No extra data is sent; there is no mask. /// /// /// EN_STOPNOUNDO /// /// Sent when an action occurs for which the control cannot allocate enough memory to maintain the undo state. If S_FALSE is /// returned, the action will be stopped; otherwise, the action will continue. /// /// /// /// EN_UPDATE /// /// Sent before an edit control requests a redraw of altered data or text. No additional data is sent. This event is controlled /// through the ENM_UPDATE mask. Rich Edit 2.0 and later: The ENM_UPDATE mask is ignored and the EN_UPDATE notification code /// is always sent. However, when Microsoft Rich Edit 3.0 emulates Microsoft Rich Edit 1.0, the ENM_UPDATE mask controls /// this notification. /// /// /// /// EN_VSCROLL /// /// Sent when the user clicks an edit control's vertical scroll bar or when the user scrolls the mouse wheel over the edit control, /// before the screen is updated. This is controlled through the ENM_SCROLL mask; no extra data is sent. /// /// /// ///  /// Note   The EN_MSGFILTER is not sent to TxNotify. To filter window messages, use TxSendMessage. ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txnotify HRESULT TxNotify( [in] DWORD iNotify, // [in] void *pv ); [PreserveSig] HRESULT TxNotify(EditNotification iNotify, IntPtr pv); /// Releases the device context obtained by the ITextHost::TxGetDC method. /// /// Type: HDC /// Handle to the device context to release. /// /// /// Type: INT /// Returns 1 if hdc was released; otherwise 0. /// For more information on COM error codes, see Error Handling in COM. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txreleasedc INT TxReleaseDC( [in] HDC hdc ); [PreserveSig] int TxReleaseDC(HDC hdc); /// Converts the screen coordinates to the text host window coordinates. /// /// Type: LPPOINT /// The screen coordinates to convert. /// /// /// Type: BOOL /// Return TRUE if the call succeeds. /// Return FALSE if the call fails. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txscreentoclient BOOL TxScreenToClient( [in] // LPPOINT lppt ); [PreserveSig] bool TxScreenToClient(in POINT lppt); /// Requests the text host to scroll the content of the specified client area. /// /// Type: INT /// Amount of horizontal scrolling. /// /// /// Type: INT /// Amount of vertical scrolling. /// /// /// Type: LPCRECT /// The coordinates for the scroll rectangle. /// /// /// Type: LPCRECT /// The coordinates for the clip rectangle. /// /// /// Type: HRGN /// Handle to the update region. /// /// /// Type: LPRECT /// The coordinates for the update rectangle. /// /// /// Type: UINT /// Scrolling flags. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// SW_ERASE /// /// Erases the newly invalidated region by sending a WM_ERASEBKGND message to the window when specified with the SW_INVALIDATE flag. /// /// /// /// SW_INVALIDATE /// Invalidates the region identified by the hrgnUpdate parameter after scrolling. /// /// /// SW_SCROLLCHILDREN /// /// Scrolls all child windows that intersect the rectangle pointed to by the lprcScroll parameter. The child windows are /// scrolled by the number of pixels specified by the dx and dy parameters. The system sends a WM_MOVE message to all /// child windows that intersect the lprcScroll rectangle, even if they do not move. /// /// /// /// SW_SMOOTHSCROLL /// /// Scrolls using smooth scrolling. Use the HIWORD portion of the fuScroll parameter to indicate how much time the /// smooth-scrolling operation should take. /// /// /// /// /// None /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txscrollwindowex void TxScrollWindowEx( [in] // INT dx, [in] INT dy, [in] LPCRECT lprcScroll, [in] LPCRECT lprcClip, [in] HRGN hrgnUpdate, [in] LPRECT lprcUpdate, [in] UINT // fuScroll ); [PreserveSig] void TxScrollWindowEx(int dx, int dy, in RECT lprcScroll, in RECT lprcClip, [In] HRGN hrgnUpdate, in RECT lprcUpdate, ScrollWindowFlags fuScroll); /// Sets the mouse capture in the text host's window. /// /// Type: BOOL /// /// Indicates whether to set or release the mouse capture. If TRUE, the mouse capture is set. If FALSE, the mouse /// capture is released. /// /// /// None /// This method is only valid when the control is in-place active; calls while the control is inactive may do nothing. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetcapture void TxSetCapture( [in] BOOL // fCapture ); [PreserveSig] void TxSetCapture(bool fCapture); /// Moves the caret position to the specified coordinates in the text host window. /// /// Type: INT /// Horizontal position (in client coordinates). /// /// /// Type: INT /// Vertical position (in client coordinates). /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetcaretpos BOOL TxSetCaretPos( [in] INT x, // [in] INT y ); [PreserveSig] bool TxSetCaretPos(int x, int y); /// Establishes a new cursor shape (I-beam) in the text host's window. /// /// Type: HCURSOR /// Handle to the cursor. /// /// /// Type: BOOL /// If TRUE, indicates the caller is trying to set the text cursor. See the Remarks section for more information. /// /// None /// /// This method may be called at any time, whether the control is active or inactive. /// /// TxSetCursor should be called by the text services object to set the mouse cursor. If the fText parameter is /// TRUE, the text services object is trying to set the text cursor (the cursor appears as an I-beam when it is over text that /// is not selected). In this case, the host can set it to whatever the control MousePointer property is. This is required for /// Microsoft Visual Basic compatibility since, through the MousePointer property, the Visual Basic programmer has control over the /// shape of the mouse cursor. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetcursor void TxSetCursor( [in] HCURSOR // hcur, [in] BOOL fText ); [PreserveSig] void TxSetCursor([In] HCURSOR hcur, bool fText); /// Sets the focus to the text host window. /// None /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetfocus void TxSetFocus(); [PreserveSig] void TxSetFocus(); /// /// Sets the position of the scroll box (thumb) in the specified scroll bar and, if requested, redraws the scroll bar to reflect the /// new position of the scroll box. /// /// /// Type: INT /// Scroll bar flag. If this is SB_HORZ, horizontal scrolling is done. By default, vertical scrolling is done. /// /// /// Type: INT /// New position in scroll box. This must be within the range of scroll bar values set by ITextHost::TxSetScrollRange. /// /// /// Type: BOOL /// /// Redraw flag. If TRUE, the scroll bar is redrawn with the new position of the scroll box. If FALSE, the scroll bar /// is not redrawn. /// /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetscrollpos BOOL TxSetScrollPos( [in] INT // fnBar, [in] INT nPos, [in] BOOL fRedraw ); [PreserveSig] bool TxSetScrollPos(SB fnBar, int nPos, bool fRedraw); /// Sets the minimum and maximum position values for the specified scroll bar in the text host window. /// /// Type: INT /// Scroll bar flag. If this is SB_HORZ, horizontal scrolling is done. By default, vertical scrolling is done. /// /// /// Type: LONG /// Minimum scrolling position. /// /// /// Type: INT /// Maximum scrolling position. /// /// /// Type: BOOL /// Redraw flag. If TRUE, the scroll bar is redrawn to reflect the changes. If FALSE, the scroll bar is not redrawn. /// /// /// Type: BOOL /// Return TRUE if the arrows are enabled or disabled as specified. /// Return FALSE if the arrows are already in the requested state or an error occurs. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetscrollrange BOOL TxSetScrollRange( [in] // INT fnBar, [in] LONG nMinPos, [in] INT nMaxPos, BOOL fRedraw ); [PreserveSig] bool TxSetScrollRange(SB fnBar, int nMinPos, int nMaxPos, bool fRedraw); /// Requests the text host to create a timer with a specified time-out. /// /// Type: UINT /// Timer identifier. /// /// /// Type: UINT /// Time-out in milliseconds. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// idTimer is used in ITextHost::TxKillTimer. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsettimer BOOL TxSetTimer( [in] UINT idTimer, // [in] UINT uTimeout ); [PreserveSig] bool TxSetTimer(uint idTimer, uint uTimeout); /// Shows or hides the caret at the caret position in the text host window. /// /// Type: BOOL /// Flag. If TRUE, the caret is visible. If FALSE, the caret is hidden. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txshowcaret BOOL TxShowCaret( [in] BOOL fShow ); [PreserveSig] bool TxShowCaret(bool fShow); /// Shows or hides the scroll bar in the text host window. /// /// Type: INT /// Specifies the scroll bar(s) to be shown or hidden. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// SB_BOTH /// Shows or hides a window's standard horizontal and vertical scroll bars. /// /// /// SB_HORZ /// Shows or hides a window's standard horizontal scroll bars. /// /// /// SB_VERT /// Shows or hides a window's standard vertical scroll bar. /// /// /// /// /// Type: BOOL /// Flag. If TRUE, the scroll bars indicated by fnBar is visible. If FALSE, the scroll bar is hidden. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txshowscrollbar BOOL TxShowScrollBar( [in] INT // fnBar, [in] BOOL fShow ); [PreserveSig] bool TxShowScrollBar(SB fnBar, bool fShow); /// Indicates to the text host that the update region has changed. /// /// Type: BOOL /// Update flag. If TRUE, the text host calls UpdateWindow; otherwise it does nothing. See the Remarks section. /// /// None /// /// /// The text services object must call TxViewChange every time its visual representation has changed, even if the control is /// inactive. If the control is active, then text services must also make sure the control's window is updated. It can do this in a /// number of ways: /// /// /// /// /// Call ITextHost::TxGetDC to get a device context for the control's window and then repaint or update the window. Afterward, call ITextHost::TxReleaseDC. /// /// /// /// Call ITextHost::TxInvalidateRect to invalidate the control's window. /// /// /// Call ITextHost::TxScrollWindowEx to scroll the control's window. /// /// /// /// After the text services object has updated the active view, it can call TxViewChange and set fUpdate to TRUE /// along with the call. By passing TRUE, the text host calls UpdateWindow to make sure any unpainted areas of the active /// control are repainted. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txviewchange void TxViewChange( [in] BOOL // fUpdate ); [PreserveSig] void TxViewChange(bool fUpdate); } /// /// The ITextHost2 interface extends the ITextHost interface. The purpose of these interfaces, along with ITextServices and /// ITextServices2, is to enable rich edit controls to run without a dedicated window. The rich edit client typically has a window ( /// HWND) that it shares with a number of windowless controls. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nl-textserv-itexthost2 [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextHost2")] [ComVisible(true), Guid("13e670f5-1a5a-11cf-abeb-00aa00b65ea1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITextHost2 : ITextHost { /// Requests the device context for the text host window. /// /// Type: HDC /// If the method succeeds, return the handle of the device context for the client area of the text host window. /// If the method fails, return NULL. For more information on COM error codes, see Error Handling in COM. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetdc HDC TxGetDC(); [PreserveSig] new HDC TxGetDC(); /// Releases the device context obtained by the ITextHost::TxGetDC method. /// /// Type: HDC /// Handle to the device context to release. /// /// /// Type: INT /// Returns 1 if hdc was released; otherwise 0. /// For more information on COM error codes, see Error Handling in COM. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txreleasedc INT TxReleaseDC( [in] HDC hdc ); [PreserveSig] new int TxReleaseDC(HDC hdc); /// Shows or hides the scroll bar in the text host window. /// /// Type: INT /// Specifies the scroll bar(s) to be shown or hidden. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// SB_BOTH /// Shows or hides a window's standard horizontal and vertical scroll bars. /// /// /// SB_HORZ /// Shows or hides a window's standard horizontal scroll bars. /// /// /// SB_VERT /// Shows or hides a window's standard vertical scroll bar. /// /// /// /// /// Type: BOOL /// Flag. If TRUE, the scroll bars indicated by fnBar is visible. If FALSE, the scroll bar is hidden. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txshowscrollbar BOOL TxShowScrollBar( [in] INT // fnBar, [in] BOOL fShow ); [PreserveSig] new bool TxShowScrollBar(SB fnBar, bool fShow); /// Enables or disables one or both scroll bar arrows in the text host window. /// /// Type: INT /// Specifies which scroll bar is affected. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// SB_BOTH /// Affects both the horizontal and vertical scroll bars. /// /// /// SB_HORZ /// Affects the horizontal scroll bar. /// /// /// SB_VERT /// Affects the vertical scroll bar. /// /// /// /// /// Type: INT /// Specifies which scroll bar arrows are enabled or disabled. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// ESB_DISABLE_BOTH /// Disables both arrows on a scroll bar. /// /// /// ESB_DISABLE_DOWN /// Disables the down arrow on a vertical scroll bar. /// /// /// ESB_DISABLE_LEFT /// Disables the left arrow on a horizontal scroll bar. /// /// /// ESB_DISABLE_LTUP /// Disables the left arrow on a horizontal scroll bar or the up arrow of a vertical scroll bar. /// /// /// ESB_DISABLE_RIGHT /// Disables the right arrow on a horizontal scroll bar. /// /// /// ESB_DISABLE_RTDN /// Disables the right arrow on a horizontal scroll bar or the down arrow of a vertical scroll bar. /// /// /// ESB_DISABLE_UP /// Disables the up arrow on a vertical scroll bar. /// /// /// ESB_ENABLE_BOTH /// Enables both arrows on a scroll bar. /// /// /// /// /// Type: BOOL /// Return nonzero if the arrows are enabled or disabled as specified. /// Return zero if the arrows are already in the requested state or an error occurs. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txenablescrollbar BOOL TxEnableScrollBar( [in] // INT fuSBFlags, [in] INT fuArrowflags ); [PreserveSig] new bool TxEnableScrollBar(SB fuSBFlags, ESB_FLAGS fuArrowflags); /// Sets the minimum and maximum position values for the specified scroll bar in the text host window. /// /// Type: INT /// Scroll bar flag. If this is SB_HORZ, horizontal scrolling is done. By default, vertical scrolling is done. /// /// /// Type: LONG /// Minimum scrolling position. /// /// /// Type: INT /// Maximum scrolling position. /// /// /// Type: BOOL /// Redraw flag. If TRUE, the scroll bar is redrawn to reflect the changes. If FALSE, the scroll bar is not redrawn. /// /// /// Type: BOOL /// Return TRUE if the arrows are enabled or disabled as specified. /// Return FALSE if the arrows are already in the requested state or an error occurs. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetscrollrange BOOL TxSetScrollRange( [in] // INT fnBar, [in] LONG nMinPos, [in] INT nMaxPos, BOOL fRedraw ); [PreserveSig] new bool TxSetScrollRange(SB fnBar, int nMinPos, int nMaxPos, bool fRedraw); /// /// Sets the position of the scroll box (thumb) in the specified scroll bar and, if requested, redraws the scroll bar to reflect the /// new position of the scroll box. /// /// /// Type: INT /// Scroll bar flag. If this is SB_HORZ, horizontal scrolling is done. By default, vertical scrolling is done. /// /// /// Type: INT /// New position in scroll box. This must be within the range of scroll bar values set by ITextHost::TxSetScrollRange. /// /// /// Type: BOOL /// /// Redraw flag. If TRUE, the scroll bar is redrawn with the new position of the scroll box. If FALSE, the scroll bar /// is not redrawn. /// /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetscrollpos BOOL TxSetScrollPos( [in] INT // fnBar, [in] INT nPos, [in] BOOL fRedraw ); [PreserveSig] new bool TxSetScrollPos(SB fnBar, int nPos, bool fRedraw); /// Specifies a rectangle for the text host to add to the update region of the text host window. /// /// Type: LPCRECT /// The invalid rectangle. /// /// /// Type: BOOL /// /// Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter /// is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the /// background remains unchanged. /// /// /// None /// /// This function may be called while inactive; however, the host implementation is free to invalidate an area greater than the /// requested RECT. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txinvalidaterect void TxInvalidateRect( [in] // LPCRECT prc, [in] BOOL fMode ); [PreserveSig] new void TxInvalidateRect(in RECT prc, bool fMode); /// Indicates to the text host that the update region has changed. /// /// Type: BOOL /// Update flag. If TRUE, the text host calls UpdateWindow; otherwise it does nothing. See the Remarks section. /// /// None /// /// /// The text services object must call TxViewChange every time its visual representation has changed, even if the control is /// inactive. If the control is active, then text services must also make sure the control's window is updated. It can do this in a /// number of ways: /// /// /// /// /// Call ITextHost::TxGetDC to get a device context for the control's window and then repaint or update the window. Afterward, call ITextHost::TxReleaseDC. /// /// /// /// Call ITextHost::TxInvalidateRect to invalidate the control's window. /// /// /// Call ITextHost::TxScrollWindowEx to scroll the control's window. /// /// /// /// After the text services object has updated the active view, it can call TxViewChange and set fUpdate to TRUE /// along with the call. By passing TRUE, the text host calls UpdateWindow to make sure any unpainted areas of the active /// control are repainted. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txviewchange void TxViewChange( [in] BOOL // fUpdate ); [PreserveSig] new void TxViewChange(bool fUpdate); /// Creates a new shape for windowless rich edit control's caret. /// /// Type: HBITMAP /// Handle to the bitmap for the new caret shape. /// If the windowless rich edit control has the SES_LOGICALCARET style, hbmp is a combination of the following values: /// /// /// Value /// Meaning /// /// /// CARET_CUSTOM /// An adorned caret. This value is valid only if CARET_RTL is also specified. /// /// /// CARET_ITALIC /// An italicized caret. /// /// /// CARET_NONE /// A blinking vertical bar. /// /// /// CARET_NULL /// An empty bitmap (for non-degenerate text selection). /// /// /// CARET_ROTATE90 /// A caret that is rotated clockwise by 90 degrees. /// /// /// CARET_RTL /// The caret moves right to left. /// /// /// /// /// Type: INT /// Caret width, in logical units. /// /// /// Type: INT /// Caret height, in logical units. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txcreatecaret BOOL TxCreateCaret( [in] HBITMAP // hbmp, [in] INT xWidth, [in] INT yHeight ); [PreserveSig] new bool TxCreateCaret([In] HBITMAP hbmp, int xWidth, int yHeight); /// Shows or hides the caret at the caret position in the text host window. /// /// Type: BOOL /// Flag. If TRUE, the caret is visible. If FALSE, the caret is hidden. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txshowcaret BOOL TxShowCaret( [in] BOOL fShow ); [PreserveSig] new bool TxShowCaret(bool fShow); /// Moves the caret position to the specified coordinates in the text host window. /// /// Type: INT /// Horizontal position (in client coordinates). /// /// /// Type: INT /// Vertical position (in client coordinates). /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetcaretpos BOOL TxSetCaretPos( [in] INT x, // [in] INT y ); [PreserveSig] new bool TxSetCaretPos(int x, int y); /// Requests the text host to create a timer with a specified time-out. /// /// Type: UINT /// Timer identifier. /// /// /// Type: UINT /// Time-out in milliseconds. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// idTimer is used in ITextHost::TxKillTimer. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsettimer BOOL TxSetTimer( [in] UINT idTimer, // [in] UINT uTimeout ); [PreserveSig] new bool TxSetTimer(uint idTimer, uint uTimeout); /// Requests the text host to destroy the specified timer. /// /// Type: UINT /// Identifier of the timer created by the ITextHost::TxSetTimer method. /// /// None /// This method may be called at any time, whether the control is active or inactive. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txkilltimer void TxKillTimer( [in] UINT idTimer ); [PreserveSig] new void TxKillTimer(uint idTimer); /// Requests the text host to scroll the content of the specified client area. /// /// Type: INT /// Amount of horizontal scrolling. /// /// /// Type: INT /// Amount of vertical scrolling. /// /// /// Type: LPCRECT /// The coordinates for the scroll rectangle. /// /// /// Type: LPCRECT /// The coordinates for the clip rectangle. /// /// /// Type: HRGN /// Handle to the update region. /// /// /// Type: LPRECT /// The coordinates for the update rectangle. /// /// /// Type: UINT /// Scrolling flags. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// SW_ERASE /// /// Erases the newly invalidated region by sending a WM_ERASEBKGND message to the window when specified with the SW_INVALIDATE flag. /// /// /// /// SW_INVALIDATE /// Invalidates the region identified by the hrgnUpdate parameter after scrolling. /// /// /// SW_SCROLLCHILDREN /// /// Scrolls all child windows that intersect the rectangle pointed to by the lprcScroll parameter. The child windows are /// scrolled by the number of pixels specified by the dx and dy parameters. The system sends a WM_MOVE message to all /// child windows that intersect the lprcScroll rectangle, even if they do not move. /// /// /// /// SW_SMOOTHSCROLL /// /// Scrolls using smooth scrolling. Use the HIWORD portion of the fuScroll parameter to indicate how much time the /// smooth-scrolling operation should take. /// /// /// /// /// None /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txscrollwindowex void TxScrollWindowEx( [in] // INT dx, [in] INT dy, [in] LPCRECT lprcScroll, [in] LPCRECT lprcClip, [in] HRGN hrgnUpdate, [in] LPRECT lprcUpdate, [in] UINT // fuScroll ); [PreserveSig] new void TxScrollWindowEx(int dx, int dy, in RECT lprcScroll, in RECT lprcClip, [In] HRGN hrgnUpdate, in RECT lprcUpdate, ScrollWindowFlags fuScroll); /// Sets the mouse capture in the text host's window. /// /// Type: BOOL /// /// Indicates whether to set or release the mouse capture. If TRUE, the mouse capture is set. If FALSE, the mouse /// capture is released. /// /// /// None /// This method is only valid when the control is in-place active; calls while the control is inactive may do nothing. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetcapture void TxSetCapture( [in] BOOL // fCapture ); [PreserveSig] new void TxSetCapture(bool fCapture); /// Sets the focus to the text host window. /// None /// This method is only valid when the control is in-place active; calls while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetfocus void TxSetFocus(); [PreserveSig] new void TxSetFocus(); /// Establishes a new cursor shape (I-beam) in the text host's window. /// /// Type: HCURSOR /// Handle to the cursor. /// /// /// Type: BOOL /// If TRUE, indicates the caller is trying to set the text cursor. See the Remarks section for more information. /// /// None /// /// This method may be called at any time, whether the control is active or inactive. /// /// TxSetCursor should be called by the text services object to set the mouse cursor. If the fText parameter is /// TRUE, the text services object is trying to set the text cursor (the cursor appears as an I-beam when it is over text that /// is not selected). In this case, the host can set it to whatever the control MousePointer property is. This is required for /// Microsoft Visual Basic compatibility since, through the MousePointer property, the Visual Basic programmer has control over the /// shape of the mouse cursor. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txsetcursor void TxSetCursor( [in] HCURSOR // hcur, [in] BOOL fText ); [PreserveSig] new void TxSetCursor([In] HCURSOR hcur, bool fText); /// Converts the screen coordinates to the text host window coordinates. /// /// Type: LPPOINT /// The screen coordinates to convert. /// /// /// Type: BOOL /// Return TRUE if the call succeeds. /// Return FALSE if the call fails. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txscreentoclient BOOL TxScreenToClient( [in] // LPPOINT lppt ); [PreserveSig] new bool TxScreenToClient(in POINT lppt); /// Converts text host coordinates to screen coordinates. /// /// Type: LPPOINT /// The client coordinates to convert. /// /// /// Type: BOOL /// Return TRUE if the method succeeds. /// Return FALSE if the method fails. /// /// /// /// This call is valid at any time, although it is allowed to fail. In general, if the text services object needs to translate from /// client coordinates (for example, for the TOM GetPoint method) the text services object is visible. /// /// However, if no conversion is possible, then the method fails. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txclienttoscreen BOOL TxClientToScreen( [in] // LPPOINT lppt ); [PreserveSig] new bool TxClientToScreen(in POINT lppt); /// Notifies the text host that the control is active. /// /// Type: LONG* /// The previous activation state. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Activation is not possible at this time. /// /// /// /// /// It is legal for the host to refuse an activation request; for example, the control may be minimized and thus invisible. /// The caller should be able to gracefully handle failure to activate. /// No matter how many times this method is called, only one ITextHost::TxDeactivate call is necessary to deactivate the control. /// /// This function returns an opaque handle in plOldState. The caller (the text services object) should save this handle and /// use it in a subsequent call to ITextHost::TxDeactivate. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txactivate HRESULT TxActivate( LONG *plOldState ); [PreserveSig] new HRESULT TxActivate(out int plOldState); /// Notifies the text host that the control is now inactive. /// /// Type: LONG /// New state of the control. Typically it is the value returned by ITextHost::TxActivate. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unspecified error. /// /// /// /// /// No matter how many times this method is called, only one call to ITextHost::TxActivate is necessary to activate the control. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txdeactivate HRESULT TxDeactivate( LONG // lNewState ); [PreserveSig] new HRESULT TxDeactivate(int lNewState); /// Retrieves the client coordinates of the text host's client area. /// /// Type: LPRECT /// The client coordinates of the text host's client area. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unspecified error. /// /// /// /// /// /// The client rectangle is the rectangle that the text services object is responsible for painting and managing. The host relies on /// the text services object for painting that area. And, the text services object must not paint or invalidate areas outside of that rectangle. /// /// The host forwards mouse messages to the text services object when the cursor is over the client rectangle. /// The client rectangle is expressed in client coordinates of the containing window. /// Important   The ITextHost::TxGetClientRect method will fail if called at an inactive time. ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetclientrect HRESULT TxGetClientRect( LPRECT // prc ); [PreserveSig] new HRESULT TxGetClientRect(out RECT prc); /// Requests the dimensions of the white space inset around the text in the text host window. /// /// Type: LPRECT /// /// The inset size, in client coordinates. The top, bottom, left, and right members of the RECT structure indicate how far in each /// direction the drawing should be inset. /// /// /// /// Type: HRESULT /// The return value is S_OK. /// /// /// /// The view inset is the amount of space on each side between the client rectangle and the view rectangle. The view rectangle (also /// called the Formatting rectangle) is the rectangle in which the text should be formatted . /// /// /// The view insets are passed in a RECT structure, but this is not really a rectangle. It should be treated as four independent /// values to subtract on each side of the client rectangle to figure the view rectangle. /// /// /// The view insets are passed in HIMETRIC (each HIMETRIC unit corresponds to 0.01 millimeter) so that they do not depend on the /// client rectangle and the rendering device context. /// /// /// View insets can be negative on either side of the client rectangle, leading to a bigger view rectangle than the client rectangle. /// The text should then be clipped to the client rectangle. If the view rectangle is wider than the client rectangle, then the host /// may add a horizontal scroll bar to the control. /// /// Single line–text services objects ignore the right boundary of the view rectangle when formatting text. /// The view inset is available from the host at all times, active or inactive. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetviewinset HRESULT TxGetViewInset( LPRECT // prc ); [PreserveSig] new HRESULT TxGetViewInset(out RECT prc); /// Requests the text host's default character format. /// /// Type: const CHARFORMAT** /// The default character format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// The text host retains ownership of the CHARFORMAT returned. However, the pointer returned must remain valid until the text host /// notifies the text services object through OnTxPropertyBitsChange that the default character format has changed. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetcharformat HRESULT TxGetCharFormat( const // CHARFORMATW **ppCF ); [PreserveSig] new HRESULT TxGetCharFormat(out IntPtr /* CHARFORMATW* */ ppCF); /// Requests the text host's default paragraph format. /// /// Type: const PARAFORMAT** /// The default paragraph format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// The host object retains ownership of the PARAFORMAT structure that is returned. However, the pointer returned must remain valid /// until the host notifies the text services object, through OnTxPropertyBitsChange, that the default paragraph format has changed. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetparaformat HRESULT TxGetParaFormat( const // PARAFORMAT **ppPF ); [PreserveSig] new HRESULT TxGetParaFormat(out IntPtr /* PARAFORMAT* */ ppPF); /// Retrieves the text host's color for a specified display element. /// /// Type: INT /// /// The display element whose color is to be retrieved. For a list of possible values for this parameter, see the GetSysColor function. /// /// /// /// Type: COLORREF /// The value that identifies the red, green, and blue (RGB) color value of the specified element. /// /// /// /// Note that the color returned may be different than the color that would be returned from a call to GetSysColor. This is /// the case if the host overrides the default system behavior. /// /// /// Note   Hosts should be careful about overriding normal system behavior because it can result in inconsistent UI /// (particularly with respect to Accessibility options). /// ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetsyscolor COLORREF TxGetSysColor( [in] int // nIndex ); [PreserveSig] new COLORREF TxGetSysColor(int nIndex); /// Requests the background style of the text host. /// /// Type: TXTBACKSTYLE* /// /// A variable that the text host sets to indicate the background style. The style is one of the following values from the /// TXTBACKSTYLE enumeration. /// /// /// /// Value /// Meaning /// /// /// TXTBACK_TRANSPARENT /// Background shows through. /// /// /// TXTBACK_OPAQUE /// Background does not show through. /// /// /// /// /// Type: HRESULT /// The return value is S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetbackstyle HRESULT TxGetBackStyle( // TXTBACKSTYLE *pstyle ); [PreserveSig] new HRESULT TxGetBackStyle(out TXTBACKSTYLE pstyle); /// Gets the text host's maximum allowed length for the text. /// /// Type: DWORD* /// /// The maximum allowed text length, in number of characters. If INFINITE is returned, the text services object can use as much /// memory as needed to store any specified text. /// /// /// /// Type: HRESULT /// The return value is S_OK. /// /// /// /// When this maximum is reached, the text services object should reject any further character insertion and pasted text. TxSetText /// however should still accept (and set) text longer than the maximum length. This is because this method is used for binding and is /// critical to maintaining the integrity of the data to which the control is bound. /// /// This method parallels the EM_LIMITTEXT message. /// /// If the limit returned is less than the number of characters currently in the text services object, no data is lost. Instead, no /// edits are allowed to the text other than deletion until the text is reduced to below the limit. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetmaxlength HRESULT TxGetMaxLength( DWORD // *plength ); [PreserveSig] new HRESULT TxGetMaxLength(out uint plength); /// Requests information about the scroll bars supported by the text host. /// /// Type: DWORD* /// The scroll bar. This parameter can be a combination of the following window styles related to scroll bars. /// /// /// Value /// Meaning /// /// /// /// Supports a vertical scroll bar. /// /// /// /// Supports a horizontal scroll bar. /// /// /// /// Automatically scrolls text up one page when the user presses ENTER on the last line. /// /// /// /// /// 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 ENTER, the control scrolls all text back to position zero. /// /// /// /// /// Disables scroll bars instead of hiding them when they are not needed. /// /// /// /// /// Type: HRESULT /// The return value is S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetscrollbars HRESULT TxGetScrollBars( DWORD // *pdwScrollBar ); [PreserveSig] new HRESULT TxGetScrollBars(out uint pdwScrollBar); /// Requests the text host's password character. /// /// Type: TCHAR* /// The password character. /// /// /// Type: HRESULT /// Return S_OK if the password character is enabled. /// /// Return S_FALSE if the password character is not enabled. For more information on COM error codes, see Error Handling in COM. /// /// /// /// The password character is only shown if the TXTBIT_USEPASSWORD bit is enabled in the text services object. If the password /// character changes, re-enable the TXTBIT_USEPASSWORD bit through OnTxPropertyBitsChange. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetpasswordchar HRESULT TxGetPasswordChar( // [out] TCHAR *pch ); [PreserveSig] new HRESULT TxGetPasswordChar([MarshalAs(UnmanagedType.LPTStr)] out char pch); /// Requests the special character to use for the underlining accelerator character. /// /// Type: LONG* /// /// The character position of the character to underline. This variable is set by the text host. A character position of –1 (that /// is, negative one) indicates that no character should be underlined. /// /// /// /// Type: HRESULT /// The return value is S_OK. /// /// /// /// Accelerators allow keyboard shortcuts, or accelerator keys, to various UI elements (such as buttons). Typically, the shortcut /// character is underlined. /// /// /// This method tells the text services object which character is the accelerator and thus should be underlined. Note that the text /// services object does not process accelerators; that is the responsibility of the host. /// /// This method is typically only called if the TXTBIT_SHOWACCELERATOR bit is set in the text services object. See OnTxPropertyBitsChange. /// /// Note   Any change to the text in the text services object results in the invalidation of the accelerator /// underlining. In this case, it is the host's responsibility to recalculate the appropriate character position and inform the text /// services object that a new accelerator is available. /// ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetacceleratorpos HRESULT // TxGetAcceleratorPos( LONG *pcp ); [PreserveSig] new HRESULT TxGetAcceleratorPos(out int pcp); /// Requests the native size of the control in HIMETRIC. /// /// Type: LPSIZEL /// The size of the control in HIMETRIC, that is, where the unit is .01 millimeter. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return the following COM error code if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// /// This method is used by the text services object to implement zooming. The text services object derives the zoom factor from the /// ratio between the himetric and device pixel extent of the client rectangle. Each HIMETRIC unit corresponds to 0.01 millimeter. /// /// /// [vertical zoom factor] = [pixel height of the client rect] * 2540 / [HIMETRIC vertical extent] * [pixel per vertical inch (from /// device context)] /// /// /// If the vertical and horizontal zoom factors are not the same, the text services object can ignore the horizontal zoom factor and /// assume it is the same as the vertical one. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetextent HRESULT TxGetExtent( LPSIZEL // lpExtent ); [PreserveSig] new HRESULT TxGetExtent(out SIZE lpExtent); /// Sets the default character format for the text host. /// /// Type: const CHARFORMAT* /// The new default-character format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return one of the following COM error codes if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_FAIL /// Unspecified error. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-ontxcharformatchange HRESULT // OnTxCharFormatChange( [in] const CHARFORMATW *pCF ); [PreserveSig] new HRESULT OnTxCharFormatChange(in CHARFORMAT pCF); /// Sets the default paragraph format for the text host. /// /// Type: const PARAFORMAT* /// The new default paragraph format. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// /// Return one of the following COM error codes if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_FAIL /// Unspecified error. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-ontxparaformatchange HRESULT // OnTxParaFormatChange( [in] const PARAFORMAT *pPF ); [PreserveSig] new HRESULT OnTxParaFormatChange(in PARAFORMAT pPF); /// Requests the bit property settings for the text host. /// /// Type: DWORD /// Mask of properties in which the caller is interested. For the possible bit values, see dwBits in OnTxPropertyBitsChange. /// /// /// Type: DWORD* /// The current settings for the properties specified by dwMask. /// /// /// Type: HRESULT /// The return value is S_OK. /// /// This call is valid at any time, for any combination of requested property bits. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetpropertybits HRESULT TxGetPropertyBits( // [in] DWORD dwMask, [in] DWORD *pdwBits ); [PreserveSig] new HRESULT TxGetPropertyBits(TXTBIT dwMask, out TXTBIT pdwBits); /// Notifies the text host of various events. /// /// Type: DWORD /// Event to notify host of. One of the EN_ notification codes. /// /// /// Type: void* /// Extra data, dependent on iNotify. /// /// /// Type: HRESULT /// Return S_OK if the method succeeds. /// Return S_FALSE if the method fails. For more information on COM error codes, see Error Handling in COM. /// /// /// /// Note that there are two basic categories of events, direct and delayed . Direct events are sent immediately because /// they need some processing, for example, EN_PROTECTED. Delayed events are sent after all processing has occurred; the control is /// thus in a stable state. Examples of delayed notifications are EN_CHANGE, EN_ERRSPACE, and EN_SELCHANGE. /// /// /// The notification events are the same as the notification codes sent to the parent window of a rich edit window. The firing of /// events may be controlled with a mask set through the EM_SETEVENTMASK message. /// /// /// In general, it is legal to make calls to the text services object while processing this method; however, implementers are /// cautioned to avoid excessive recursion. /// /// The following is a list of the notifications that may be sent. /// /// /// Notification /// Meaning /// /// /// EN_CHANGE /// /// Sent after the system updates the screen, when the user takes an action that may have altered text in the control. /// /// /// /// EN_DROPFILES /// Sent when either a WM_DROPFILES message or an IDropTarget::DragEnter notification is received. /// /// /// EN_ERRSPACE /// Sent when a control cannot allocate enough memory to meet a specified request. /// /// /// EN_HSCROLL /// Sent when the user clicks the control's horizontal scroll bar before the screen is updated. /// /// /// EN_KILLFOCUS /// Sent when the control loses the keyboard focus. /// /// /// EN_LINK /// /// Sent when a rich edit control receives various messages, such as mouse click messages, when the mouse pointer is over text that /// has the CFE_LINK effect. /// /// /// /// EN_MAXTEXT /// Sent when the current text insertion has exceeded the maximum number of characters for the control. /// /// /// EN_OLEOPFAILED /// Sent when a user action on an OLE object has failed. /// /// /// EN_PROTECTED /// Sent when the user takes an action that changes the protected range of text. /// /// /// EN_REQUESTRESIZE /// Sent when a rich edit control's contents are different from the control's window size. /// /// /// EN_SAVECLIPBOARD /// /// Sent when an edit control is being destroyed. The text host should indicate whether OleFlushClipboard should be called. Data /// indicating the number of characters and objects to be flushed is sent in the ENSAVECLIPBOARD data structure. Mask value is nothing. /// /// /// /// EN_SELCHANGE /// /// Sent when the current selection has changed. A SELCHANGE data structure is also sent, which indicates the new selection range at /// the type of data the selection is currently over. Controlled through the ENM_SELCHANGE mask. /// /// /// /// EN_SETFOCUS /// Sent when the edit control receives the keyboard focus. No extra data is sent; there is no mask. /// /// /// EN_STOPNOUNDO /// /// Sent when an action occurs for which the control cannot allocate enough memory to maintain the undo state. If S_FALSE is /// returned, the action will be stopped; otherwise, the action will continue. /// /// /// /// EN_UPDATE /// /// Sent before an edit control requests a redraw of altered data or text. No additional data is sent. This event is controlled /// through the ENM_UPDATE mask. Rich Edit 2.0 and later: The ENM_UPDATE mask is ignored and the EN_UPDATE notification code /// is always sent. However, when Microsoft Rich Edit 3.0 emulates Microsoft Rich Edit 1.0, the ENM_UPDATE mask controls /// this notification. /// /// /// /// EN_VSCROLL /// /// Sent when the user clicks an edit control's vertical scroll bar or when the user scrolls the mouse wheel over the edit control, /// before the screen is updated. This is controlled through the ENM_SCROLL mask; no extra data is sent. /// /// /// ///  /// Note   The EN_MSGFILTER is not sent to TxNotify. To filter window messages, use TxSendMessage. ///  /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txnotify HRESULT TxNotify( [in] DWORD iNotify, // [in] void *pv ); [PreserveSig] new HRESULT TxNotify(EditNotification iNotify, IntPtr pv); /// /// Retrieves the Input Method Editor (IME) input context associated with the text services host. /// This method is used only in Asian-language versions of the operating system. /// /// /// Type: HIMC /// The handle to the input context. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-tximmgetcontext HIMC TxImmGetContext(); [PreserveSig] new HIMC TxImmGetContext(); /// /// /// Releases an input context returned by the ITextHost::TxImmGetContext method and unlocks the memory associated with the context. /// /// This method is used only in Asian-language versions of the operating system. /// /// /// Type: HIMC /// The input context. /// /// None // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-tximmreleasecontext void TxImmReleaseContext( // [in] HIMC himc ); [PreserveSig] new void TxImmReleaseContext([In] HIMC himc); /// Returns the size of selection bar in HIMETRIC. /// /// Type: LONG* /// The width, in HIMETRIC (that is, where the units are .01 millimeter), of the selection bar. /// /// /// Type: HRESULT /// The return value is S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost-txgetselectionbarwidth HRESULT // TxGetSelectionBarWidth( LONG *lSelBarWidth ); [PreserveSig] new HRESULT TxGetSelectionBarWidth(out int lSelBarWidth); /// Discovers whether the message queue contains a WM_LBUTTONDBLCLK message that is pending for the text host window. /// /// Type: BOOL /// Returns TRUE if a WM_LBUTTONDBLCLK message is pending, or FALSE if not. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txisdoubleclickpending BOOL TxIsDoubleClickPending(); [PreserveSig] bool TxIsDoubleClickPending(); /// Retrieves the handle of the text host window for the rich edit control. /// /// Type: HWND* /// The handle of the text host window. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txgetwindow HRESULT TxGetWindow( HWND *phwnd ); [PreserveSig] HRESULT TxGetWindow(out HWND phwnd); /// Sets the rich edit control's host window as the foreground window. /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txsetforegroundwindow HRESULT TxSetForegroundWindow(); [PreserveSig] HRESULT TxSetForegroundWindow(); /// Retrieves the color palette of the rich edit control. /// /// Type: HPALETTE /// Returns the color palette, or NULL if the control uses the system default color palette. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txgetpalette HPALETTE TxGetPalette(); [PreserveSig] HPALETTE TxGetPalette(); /// Gets whether Input Method Editor (IME) input is allowed and whether the edit styles include ES_SELFIME. /// /// Type: LONG* /// The East Asian flags. /// /// /// Value /// Meaning /// /// /// ES_NOIME /// IME input is suppressed. /// /// /// ES_SELFIME /// The rich edit client handles IME input. /// /// /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txgeteastasianflags HRESULT // TxGetEastAsianFlags( LONG *pFlags ); [PreserveSig] HRESULT TxGetEastAsianFlags(out RichEditStyle pFlags); /// Sets the shape of the cursor in the text host window. /// /// Type: HCURSOR /// The new cursor shape. /// /// /// Type: BOOL /// TRUE if the cursor is used for text, or FALSE if not. /// /// /// Type: HCURSOR /// Returns the cursor that hcur is replacing. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txsetcursor2 HCURSOR TxSetCursor2( HCURSOR // hcur, BOOL bText ); [PreserveSig] HCURSOR TxSetCursor2(HCURSOR hcur, bool bText); /// Notifies the text host that text services have been freed. /// None /// /// If the text host hasn't received this notification when the text host is shutting down, the text host can tell text services to /// release its text host reference count. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txfreetextservicesnotification void TxFreeTextServicesNotification(); [PreserveSig] void TxFreeTextServicesNotification(); /// Gets whether a rich edit control is in a dialog box. /// /// Type: DWORD /// Mask that indicates the edit style flags to retrieve. It can be the following value. /// TXES_ISDIALOG /// /// /// Type: DWORD* /// /// /// Value /// Meaning /// /// /// TXES_ISDIALOG /// Indicates that the host of the rich edit control is a dialog box. /// /// /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txgeteditstyle HRESULT TxGetEditStyle( DWORD // dwItem, DWORD *pdwData ); [PreserveSig] HRESULT TxGetEditStyle(TXES dwItem, out TXES pdwData); /// Retrieves the window styles and extended windows styles of the text host window. /// /// Type: DWORD* /// The window styles. For a description of the possible values, see Window Styles. /// /// /// Type: DWORD* /// The extended windows styles. For a description of the possible values, see Extended Window Styles. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txgetwindowstyles HRESULT TxGetWindowStyles( // DWORD *pdwStyle, DWORD *pdwExStyle ); [PreserveSig] HRESULT TxGetWindowStyles(out WindowStyles pdwStyle, out WindowStylesEx pdwExStyle); /// Shows or hides the caret during the drop portion of a drag-and-drop operation (Direct2D only). /// /// Type: BOOL /// Show or hide flag. TRUE shows the drop caret, and FALSE hides it. /// /// /// Type: HDC /// The HDC. /// /// /// Type: LPCRECT /// The drop caret rectangle. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txshowdropcaret HRESULT TxShowDropCaret( BOOL // fShow, HDC hdc, LPCRECT prc ); [PreserveSig] HRESULT TxShowDropCaret(bool fShow, HDC hdc, in RECT prc); /// Destroys the caret (Direct2D only). /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txdestroycaret HRESULT TxDestroyCaret(); [PreserveSig] HRESULT TxDestroyCaret(); /// Gets the horizontal scroll extent of the text host window. /// /// Type: LONG* /// The horizontal scroll extent. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// A rich edit control doesn't use the return value; instead, they get the scroll width from the widest line. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itexthost2-txgethorzextent HRESULT TxGetHorzExtent( LONG // *plHorzExtent ); [PreserveSig] HRESULT TxGetHorzExtent(out int plHorzExtent); } /// Extends the Text Object Model (TOM) to provide extra functionality for windowless operation. /// /// /// In conjunction with the ITextHost interface, ITextServices provides the means by which a rich edit control can be used /// without creating a window. /// /// When to Implement /// Applications do not implement the ITextServices interface. /// When to Use /// /// Applications can call the CreateTextServices function to create a text services object. To retrieve an ITextServices pointer, /// call QueryInterface on the private IUnknown pointer returned by CreateTextServices. You can then call the ITextServices /// methods to send messages to the text services object. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nl-textserv-itextservices [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextServices")] [ComVisible(true), Guid("8D33F740-CF58-11CE-A89D-00AA006CADC5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITextServices { /// Used by the window host to forward messages sent from its window to the text services object. /// /// Type: UINT /// The message identifier. /// /// /// Type: WPARAM /// The WPARAM from the window's message. /// /// /// Type: LPARAM /// The LPARAM from the window's message. /// /// /// Type: LRESULT* /// The message's return LRESULT. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is one of the following HRESULT codes. For more information on COM error codes, see /// Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_OUTOFMEMORY /// Insufficient memory. NOERROR Message was processed, and some action was taken. /// /// /// S_FALSE /// /// Message was not processed. Typically indicates that the caller should process the message itself, potentially by calling DefWindowProc. /// /// /// /// S_MSG_KEYIGNORED /// Message processed, but no action was taken for the keystroke. /// /// /// /// /// /// Note that two return values are passed back from this function. The return value that should be passed back from a window /// procedure is plresult. However, in some cases, the returned LRESULT does not contain enough information. For /// example, to implement moving the cursor around controls, it's useful to know if a keystroke (such as right arrow) was processed /// but ignored (for example, the caret is already at the rightmost position in the text). In these cases, more information may be /// returned through the returned HRESULT. /// /// /// WM_CHAR and WM_KEYDOWN should return the value S_MSG_KEYIGNORED when a key or character is recognized, but has no effect, given /// the current state. For example, S_MSG_KEYIGNORED should be returned in the following cases: /// /// /// /// /// Any keystroke that tries to move the insertion point to or beyond the beginning or the end of the document; when it is already at /// the beginning or end of the document, respectively. /// /// /// /// /// Any keystroke that tries to move the insertion point to or past the next line when it is already on the last line; or to or /// before the previous line when it is already on the first line. /// /// /// /// /// Any insertion of the character from WM_CHAR that would move the insertion point past the maximum length of the control. /// /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txsendmessage HRESULT TxSendMessage( UINT // msg, WPARAM wparam, LPARAM lparam, LRESULT *plresult ); [PreserveSig] HRESULT TxSendMessage(uint msg, IntPtr wparam, IntPtr lparam, out IntPtr plresult); /// Draws the text services object. /// /// Type: DWORD /// /// Specifies the aspect to be drawn, that is, how the object is to be represented. Draw aspect can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// /// Renders a screen image of the text content to the hdcDraw device context. The hicTargetDev and ptd /// parameters give information on the target device context if any (usually a printer). /// /// /// /// DVASPECT_DOCPRINT /// /// Renders the object to the hdcDraw device context as though it were printed to a printer. Thus, the text services object /// can optimize for the printer (for example, not painting the background color, if white). Also, certain screen-specific elements /// (such as the selection) should not be rendered. ITextServices::TxDraw should render the lprcBounds rectangle, /// starting at the current scrolling position. /// /// /// /// /// /// Type: LONG /// Not supported. /// /// /// Type: void* /// Information for drawing optimizations. /// /// /// Type: DVTARGETDEVICE* /// The target device. /// /// /// Type: HDC /// Rendering device context. /// /// /// Type: HDC /// Target information context. /// /// /// Type: LPCRECTL /// The bounding (client) rectangle. /// /// /// Type: LPCRECTL /// The clipping rectangle for metafiles. /// /// /// Type: LPRECT /// The update region inside lprcBounds. /// /// /// Type: BOOL CALLBACK* /// Not supported. /// /// /// Type: DWORD /// Parameter to pass to continue function. /// /// /// Type: LONG /// Specifies the view to draw. /// /// /// Value /// Meaning /// /// /// TXTVIEW_ACTIVE /// Draw the inplace active view. /// /// /// TXTVIEW_INACTIVE /// Draw a view other than the inplace active view; for example, a print preview. /// /// /// /// /// Type: HRESULT /// The return value is typically S_OK. /// /// /// /// This method renders the text services object. It accepts the same parameters as the corresponding IViewObject::Draw method in /// OLE, with the extra lprcUpdate and the lViewId parameters. It can be used while the host is in-place active or inactive. /// /// /// The lprcBounds parameter gives the rectangle to render, also called the client rectangle. This rectangle represents the /// position and extent of the entire image of the text services object to be drawn. It is expressed in the logical coordinate system /// of hdcDraw. If lprcBounds is NULL then the control must be active. In this case, the text services object /// should render the in-place active view (that is, the client rectangle that can be obtained by calling TxGetClientRect on the host). /// /// /// If the lprcUpdate parameter is not NULL, it gives the rectangle to update inside that client rectangle, in the /// logical coordinate system of hdcDraw. If lprcUpdate is NULL, the entire client rectangle should be painted. /// /// /// The text services object should render with the appropriate zoom factor, which can be obtained from the client rectangle and the /// native size given by TxGetExtent. For a discussion of the zoom factor, see TxGetExtent. /// /// General comments on OLE hosts and ITextServices::TxDraw (also for ITextServices::OnTxSetCursor, and ITextServices::TxQueryHitPoint): /// /// An OLE host can call the ITextServices::TxDraw method at any time with any rendering device context or client rectangle. /// An OLE object that is inactive only retains an extent. To get the rectangle in which to render, the host calls the /// IViewObject::Draw method. This rectangle is valid only for the scope of that method. Thus, the same control can be rendered /// consecutively in different rectangles and different device contexts, for example, because it is displayed simultaneously in /// different views on the screen. /// /// /// Normally, the client rectangle and device context passed to ITextServices::TxDraw should not be cached, because this would /// force the text services object to recalculate lines for every draw, which would impede performance. Instead, the text services /// object could cache the information that is computed for a specific client rectangle and device context (such as line breaks). On /// the next call to ITextServices::TxDraw, however, the validity of the cached information should be checked before it gets /// used, and updated information should be regenerated, if necessary. /// /// /// Also, take great care when the control is in-place active. This problem is even more complex since ITextServices::TxDraw /// can still be called to render other views than the one that is in-place active. In other words, the client rectangle passed to /// ITextServices::TxDraw may not be the same as the active one (passed to ITextServices::OnTxInPlaceActivate and obtained /// through TxGetClientRect on the host). /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txdraw HRESULT TxDraw( [in] DWORD // dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] LPCRECTL // lprcBounds, [in] LPCRECTL lprcWBounds, [in] LPRECT lprcUpdate, BOOL(* )(DWORD) pfnContinue, DWORD dwContinue, LONG lViewId ); [PreserveSig] HRESULT TxDraw(DVASPECT dwDrawAspect, int lindex, IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcBounds, in RECT lprcWBounds, in RECT lprcUpdate, IntPtr pfnContinue, uint dwContinue, TXTVIEW lViewId); /// Returns horizontal scroll bar information. /// /// Type: LONG* /// The minimum scroll position. /// /// /// Type: LONG* /// The maximum scroll position. /// /// /// Type: LONG* /// The current scroll position. /// /// /// Type: LONG* /// The view width, in pixels. /// /// /// Type: BOOL* /// Indicates whether horizontal scrolling is enabled. If TRUE, horizontal scrolling is enabled. /// /// /// Type: HRESULT /// The method always returns S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgethscroll HRESULT TxGetHScroll( LONG // *plMin, LONG *plMax, LONG *plPos, LONG *plPage, BOOL *pfEnabled ); [PreserveSig] HRESULT TxGetHScroll(out int plMin, out int plMax, out int plPos, out int plPage, out bool pfEnabled); /// Returns vertical scroll bar state information. /// /// Type: LONG* /// The minimum scroll position. /// /// /// Type: LONG* /// The maximum scroll position. /// /// /// Type: LONG* /// The current scroll position. /// /// /// Type: LONG* /// The height of view in pixels. /// /// /// Type: BOOL* /// /// Indicates whether the vertical scroll bar is enabled. If TRUE, the vertical scroll bar is enabled; otherwise it is disabled. /// /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is one of the following HRESULT codes. For more information on COM error codes, see /// Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unspecified error. /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetvscroll HRESULT TxGetVScroll( LONG // *plMin, LONG *plMax, LONG *plPos, LONG *plPage, BOOL *pfEnabled ); [PreserveSig] HRESULT TxGetVScroll(out int plMin, out int plMax, out int plPos, out int plPage, out bool pfEnabled); /// Notifies the text services object to set the cursor. /// /// Type: DWORD /// Draw aspect can be one of the following values. /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// /// Renders a screen image of the text content to the hdcDraw device context. The hicTargetDev and ptd /// parameters give information on the target device context if any (usually a printer). /// /// /// /// DVASPECT_DOCPRINT /// /// Renders the object to the hdcDraw device context as though it were printed to a printer. Thus, the text services object /// can optimize for the printer (for example, not painting the background color, if white). Also, certain screen-specific elements /// (such as the selection) should not be rendered. ITextServices::OnTxSetCursor should render the lprcClient /// rectangle, starting at the current scrolling position. /// /// /// /// /// /// Type: LONG /// Not supported. /// /// /// Type: void* /// Information for drawing optimizations. /// /// /// Type: DVTARGETDEVICE* /// The target device. /// /// /// Type: HDC /// Rendering device context. /// /// /// Type: HDC /// Target information context. /// /// /// Type: LPCRECT /// /// The control's client rectangle. The coordinates of the rectangle are in client coordinates of the containing window. NULL /// is a legal value. /// /// /// /// Type: INT /// x position of cursor, in the client coordinates of the containing window. /// /// /// Type: INT /// y position of cursor, in the client coordinates of the containing window. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more illegal parameters. /// /// /// /// /// /// The text services object may remeasure as a result of this call to determine the correct cursor. The correct cursor is set /// through TxSetCursor. /// /// /// The lprcClient parameter is the client rectangle of the view of the control over which the mouse cursor is positioned. The /// lprcClient parameter is in device coordinates of the containing window in the same way the WM_SIZE message is. This may /// not be the view that was rendered last. Furthermore, if the control is in-place active, this may not be the current active view . /// As a consequence, the text services object should check this rectangle against its current cache's value and determine whether /// recalculating the lines is necessary or not. The zoom factor should be included in this computation. For a discussion of the zoom /// factor, see TxGetExtent. /// /// /// This method should be called only for screen views of the control. Therefore the device context (DC) is not passed in, but should /// be assumed to be a screen DC. /// /// For more information, see the Remarks in ITextServices::TxDraw. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxsetcursor HRESULT OnTxSetCursor( [in] // DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] // LPCRECT lprcClient, [in] INT x, [in] INT y ); [PreserveSig] HRESULT OnTxSetCursor(uint dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y); /// Tests whether a specified point is within the rectangle of the text services object. /// /// Type: DWORD /// Draw aspect can be one of the following values. /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// /// Renders a screen image of the text content to the hdcDraw device context. The hicTargetDev and ptd /// parameters give information on the target device context if any (usually a printer). /// /// /// /// DVASPECT_DOCPRINT /// /// Renders the object to the hdcDraw device context as though it were printed to a printer. Thus, the text services object /// can optimize for the printer (for example, not painting the background color, if white). Also, certain screen-specific elements /// (such as the selection) should not be rendered. ITextServices::TxGetNaturalSize should render the lprcClient rectangle, /// starting at the current scrolling position. /// /// /// /// /// /// Type: LONG /// Not supported. /// /// /// Type: void* /// Information for drawing optimizations. /// /// /// Type: DVTARGETDEVICE* /// Information on the target device. /// /// /// Type: HDC /// Rendering device context. /// /// /// Type: HDC /// Target information context. /// /// /// Type: LPCRECT /// The control's client rectangle, in client (device) coordinates of the view in which the hit testing is done. /// /// /// Type: INT /// x-coordinate to check, in client coordinates, of the view in which hit testing is done. /// /// /// Type: INT /// y-coordinate to check, in client coordinates, of the view in which hit testing is done. /// /// /// Type: DWORD* /// The result of the hit test. It can be any of the following TXTHITRESULT enumeration values. /// /// /// Value /// Meaning /// /// /// TXTHITRESULT_CLOSE /// The point is in the client rectangle and close to a nontransparent area. /// /// /// TXTHITRESULT_HIT /// The point is in the client rectangle and either over text or the background is not transparent. /// /// /// TXTHITRESULT_NOHIT /// The point is outside of the client rectangle. /// /// /// TXTHITRESULT_TRANSPARENT /// The point is in the client rectangle and either not over text or the background was transparent. /// /// /// /// /// Type: HRESULT /// The return value is an HRESULT code. /// /// /// This method allows the host to implement transparent hit testing on text. /// For more information, see the Remarks section in ITextServices::TxDraw and ITextServices::OnTxSetCursor. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txqueryhitpoint HRESULT TxQueryHitPoint( // [in] DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] // LPCRECT lprcClient, [in] INT x, [in] INT y, [out] DWORD *pHitResult ); [PreserveSig] HRESULT TxQueryHitPoint(DVASPECT dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y, out uint pHitResult); /// Notifies the text services object that this control is in-place active. /// /// Type: const RECT* /// The control's client rectangle. /// /// /// Type: HRESULT /// If the object is successfully activated, the return value is S_OK. /// /// If the object could not be activated due to error, the return value is E_FAIL. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// /// In-place active means that an embedded object is running in-place (for example, for regular controls and embeddings, it /// would have a window to draw in). In contrast, UI active means that an object currently has the editing focus. For example, /// things like menus and toolbars on the container may also contain elements from the UI-active control/embedding. There is only one /// UI-active control at any given time, while there can be many in-place active controls. /// /// /// Note, UI activation is different from getting the focus. To signal the text services object that the control is getting or losing /// focus, the host sends WM_SETFOCUS and WM_KILLFOCUS messages. Also, note that a windowless host will pass NULL as the /// wParam (window that lost the focus) for these messages. /// /// /// When making the transition directly from a nonactive state to the UI-active state, the host should call /// ITextServices::OnTxInPlaceActivate first and then ITextServices::OnTxUIActivate. /// /// /// ITextServices::OnTxInPlaceActivate takes as a parameter the client rectangle of the view being activated. This rectangle /// is given in client coordinates of the containing window. It is the same as would be obtained by calling TxGetClientRect on the host. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxinplaceactivate HRESULT // OnTxInPlaceActivate( [in] LPCRECT prcClient ); [PreserveSig] HRESULT OnTxInPlaceActivate(in RECT prcClient); /// Notifies the text services object that this control is no longer in-place active. /// /// Type: HRESULT /// The return value is always S_OK. /// /// /// /// In-place activation refers to an embedded object running in-place (for example, for regular controls and embeddings, it /// would have a window to draw in). In contrast, UI active means that an object currently has the editing focus. /// Specifically, things like menus and toolbars on the container may also contain elements from the UI-active control/embedding. /// There can only be one UI-active control at any given time, while many can be in-place active at once. /// /// /// Note, UI activation is different from getting the focus. To let the text services object know that the control is getting or /// losing focus, the host will send WM_SETFOCUS and WM_KILLFOCUS messages. Also, note that a windowless host will pass NULL /// as the wParam (window that lost the focus) for these messages. /// /// /// When making the transition from the UI-active state to a nonactive state, the host should call ITextServices::OnTxUIDeactivate /// first and then ITextServices::OnTxInPlaceDeactivate. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxinplacedeactivate HRESULT OnTxInPlaceDeactivate(); [PreserveSig] HRESULT OnTxInPlaceDeactivate(); /// Informs the text services object that the control is now UI active. /// /// Type: HRESULT /// The method always returns S_OK. /// /// See ITextServices::OnTxInPlaceActivate for a detailed description of activation. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxuiactivate HRESULT OnTxUIActivate(); [PreserveSig] HRESULT OnTxUIActivate(); /// Informs the text services object that the control is no longer UI active. /// /// Type: HRESULT /// The method always returns S_OK. /// /// See ITextServices::OnTxInPlaceActivate for a detailed description of deactivation. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxuideactivate HRESULT OnTxUIDeactivate(); [PreserveSig] HRESULT OnTxUIDeactivate(); /// Returns all of the Unicode plain text in the control as a BSTR. /// /// Type: BSTR * /// The Unicode plain text. /// /// /// Type: HRESULT /// If the text is successfully returned in the output argument, the return value is S_OK. /// /// If the method fails, the return value is one of the following HRESULT codes. For more information on COM error codes, see /// Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// Invalid BSTR pointer passed in. /// /// /// E_OUTOFMEMORY /// Could not allocate memory for copy of the text. /// /// /// /// /// The host (caller) takes ownership of the returned BSTR. /// Other ways to retrieve plain text data are to use WM_GETTEXT or the Text Object Model (TOM) GetText method. /// If there is no text in the control, the BSTR is allocated and 0x000D is returned in it. /// The returned text will not necessarily be null-terminated. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgettext HRESULT TxGetText( BSTR // *pbstrText ); [PreserveSig] HRESULT TxGetText([MarshalAs(UnmanagedType.BStr)] out string pbstrText); /// Sets all of the text in the control. /// /// Type: LPCTSTR /// The string which will replace the current text. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Text could not be updated. /// /// /// /// /// /// This method should be used with care; it essentially reinitializes the text services object with some new data. Any previous data /// and formatting information will be lost, including undo information. /// /// /// If previous data has been copied to the clipboard, that data will be rendered completely to the clipboard (through /// OleFlushClipboard) before it is discarded. /// /// This method does not support Undo. /// Two alternate approaches to setting text are WM_SETTEXT and SetText. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txsettext HRESULT TxSetText( [in] LPCWSTR // pszText ); [PreserveSig] HRESULT TxSetText([MarshalAs(UnmanagedType.LPWStr)] string pszText); /// Gets the target x position, that is, the current horizontal position of the caret. /// /// /// Type: HRESULT /// If the x position of the caret is returned, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// There is no selection. /// /// /// E_INVALIDARG /// The input argument is invalid. /// /// /// /// /// /// Together with ITextServices::OnTxSetCursor, this method allows you to maintain the horizontal caret position when moving the /// caret up and down. This capability is useful when moving the caret through forms. /// /// /// The target caret position is expressed as an x-coordinate on the display because other controls do not necessarily share the same /// attributes for column position. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetcurtargetx HRESULT TxGetCurTargetX( // LONG *unnamedParam1 ); [PreserveSig] HRESULT TxGetCurTargetX(out int unnamedParam1); /// /// Gets the base line position of the first visible line, in pixels, relative to the text services client rectangle. This permits /// aligning controls on their base lines. /// /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetbaselinepos HRESULT TxGetBaseLinePos( // LONG *unnamedParam1 ); [PreserveSig] HRESULT TxGetBaseLinePos(out int unnamedParam1); /// Allows a control to be resized so it fits its content appropriately. /// /// Type: DWORD /// The aspect for the drawing. It can be any of the values from the DVASPECT enumeration. /// /// /// Type: HDC /// The device context into which drawing occurs. /// /// /// Type: HDC /// The device context for which text should be formatted (that is, for WYSIWYG). /// /// /// Type: DVTARGETDEVICE* /// More information on the target device. /// /// /// Type: DWORD /// The type of fitting requested. It can be one of the following. /// /// /// Value /// Meaning /// /// /// TXTNS_EMU /// Use English Metric Units (EMUs) instead of pixels as the measuring units for this method's parameters. /// /// /// TXTNS_FITTOCONTENT /// /// Resize the control to fit the entire text by formatting the text to the width that is passed in. The text services object returns /// the height of the entire text and the width of the widest line. For example, this should be done when the user double-clicks one /// of the control's handles. /// /// /// /// TXTNS_FITTOCONTENT2 /// Resize the control so that it fits indented content. /// /// /// TXTNS_FITTOCONTENT3 /// Resize the control so that it fits indented content and trailing whitespace. /// /// /// TXTNS_FITTOCONTENTWSP /// Resize the control so that it fits unindented content and trailing whitespace. /// /// /// TXTNS_INCLUDELASTLINE /// For a plain-text control, include the height of the final carriage return when calculating the size. /// /// /// TXTNS_ROUNDTOLINE /// /// Resize the control to show an integral number of lines (no line is clipped). Format enough text to fill the width and height that /// is passed in, and then return a height that is rounded to the nearest line boundary. /// /// /// /// /// /// Type: const SIZEL* /// Not supported. /// /// /// Type: LONG* /// The width for the fitting defined by dwMode. /// /// /// Type: LONG* /// The height for the fitting defined by dwMode. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If text services could not activate the object, the return value is one of the following HRESULT codes. For more /// information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unable to determine correct size. /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_OUTOFMEMORY /// Insufficient memory. /// /// /// /// /// /// The first four parameters are similar to equivalent parameters in ITextServices::TxDraw and give the same information. In the /// case where the lines must be recalculated, it should use these values the same ways as in ITextServices::TxDraw. /// /// /// The pwidth and pheight parameters are in/out parameters. The host passes in the tentative width and height of the /// natural extent of the text object. The text services object compares these values against its current cached state, and if /// different, recalculate lines. Then, it computes and returns the natural size, as specified by dwMode. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetnaturalsize HRESULT TxGetNaturalSize( // DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, const SIZEL *psizelExtent, [in, out] LONG // *pwidth, [in, out] LONG *pheight ); [PreserveSig] HRESULT TxGetNaturalSize(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, [In] DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight); /// Gets the drop target for the text control. /// /// Type: IDropTarget** /// The target of a drag-and-drop operation in a specified window. /// /// /// Type: HRESULT /// If the method got the drop target successfully, the return value is S_OK. /// For more information on COM error codes, see Error Handling in COM. /// /// /// Return code /// Description /// /// /// E_OUTOFMEMORY /// Could not create the drop target. /// /// /// /// /// The host (caller) is responsible for calling RegisterDragDrop or RevokeDragDrop, and for calling Release on the returned drop /// target when done. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetdroptarget HRESULT TxGetDropTarget( // IDropTarget **ppDropTarget ); [PreserveSig] HRESULT TxGetDropTarget(out IDropTarget ppDropTarget); /// Sets properties (represented by bits) for the control. /// /// Type: DWORD /// Bits representing properties to be changed. For the possible bit values, see the TXTBIT_* values list in dwBits. /// /// /// Type: DWORD /// New values for bit properties. It can be any combination of the following. /// /// /// Value /// Meaning /// /// /// TXTBIT_ALLOWBEEP /// If TRUE, beeping is enabled. /// /// /// TXTBIT_AUTOWORDSEL /// If TRUE, the AutoWordSelect feature is enabled. /// /// /// TXTBIT_BACKSTYLECHANGE /// If TRUE, the backstyle changed. See TxGetBackStyle. /// /// /// TXTBIT_CHARFORMATCHANGE /// If TRUE, the character format changed. /// /// /// TXTBIT_CLIENTRECTCHANGE /// If TRUE, the client rectangle changed. /// /// /// TXTBIT_DISABLEDRAG /// If TRUE, dragging is disabled. /// /// /// TXTBIT_D2DDWRITE /// Use Direct2D/DirectWrite for this instance, and not GDI/Uniscribe. /// /// /// TXTBIT_D2DPIXELSNAPPED /// Render glyphs to the nearest pixel positions. Valid only if D2DDWRITE is set. /// /// /// TXTBIT_D2DSUBPIXELLINES /// /// Draw lines with subpixel precision. Don't pixel-snap text lines, underline, and strikethrough in the secondary text flow /// direction (usually vertical). Valid only if D2DDWRITE is set and D2DPIXELSNAPPED is not set. /// /// /// /// TXTBIT_D2DSIMPLETYPOGRAPHY /// /// Render text using simple typography (no glyph rendering). This value is valid only if TXTBIT_D2DDWRITE is also specified. /// /// /// /// TXTBIT_EXTENTCHANGE /// If TRUE, the size of the client rectangle changed. /// /// /// TXTBIT_HIDESELECTION /// /// If TRUE, the text services object should hide the selection when the control is inactive. If FALSE, the selection /// should be displayed when the control is inactive. Note, this implies TXTBIT_SAVESELECTION is TRUE. /// /// /// /// TXTBIT_MAXLENGTHCHANGE /// If TRUE, the maximum length for text in the control changed. /// /// /// TXTBIT_MULTILINE /// /// If TRUE, the text services object should work in multiline mode. Use the TXTBIT_WORDWRAP value to determine whether /// to wrap the lines to the view rectangle or clip them. If FALSE, the text services object should not process a carriage /// return/line feed from the ENTER key and it should truncate incoming text containing hard line breaks just before the first line /// break. It is also acceptable to truncate text that is set with ITextServices::TxSetText, because it is the responsibility of the /// host not to use a single-line control when bound to a multiline field. /// /// /// /// TXTBIT_NOTHREADREFCOUNT /// Don't reference TLS data on behalf of this instance. /// /// /// TXTBIT_PARAFORMATCHANGE /// If TRUE, the paragraph format changed. /// /// /// TXTBIT_READONLY /// /// If TRUE, the text services object should not accept any editing change through the user interface. However, it should /// still accept programmatic changes through EM_SETTEXTEX, EM_REPLACESEL, and ITextServices::TxSetText. Also, the user should still /// be able to move the insertion point, select text, and carry out other operations that don't modify content, such as Copy. /// /// /// /// TXTBIT_RICHTEXT /// /// If TRUE, the text services object should be in rich-text mode. If FALSE, it is in plain-text mode. Note, this /// affects how editing commands are applied. For example, applying bold to part of the text in a plain-edit control makes the entire /// text bold. However, for a rich-edit control, this makes only the selected text bold. /// /// /// /// TXTBIT_SAVESELECTION /// /// If TRUE, the boundaries of the selection should be saved when the control is inactive. If FALSE, when the control /// goes active again the selection boundaries can be reset to start = 0, length = 0. /// /// /// /// TXTBIT_SCROLLBARCHANGE /// If TRUE, the scroll bar has changed. /// /// /// TXTBIT_SELBARCHANGE /// If TRUE, the selection bar width has changed /// /// /// TXTBIT_SHOWACCELERATOR /// If set, the accelerator character should be underlined. This must be set in order to call TxGetAcceleratorPos. /// /// /// TXTBIT_SHOWPASSWORD /// Show password strings. /// /// /// TXTBIT_USECURRENTBKG /// Not supported. /// /// /// TXTBIT_USEPASSWORD /// /// If TRUE, display text using the password character obtained by TxGetPasswordChar. The notification on this property can /// mean either that the password character changed or that the password character was not used before but is used now (or vice versa). /// /// /// /// TXTBIT_VERTICAL /// Not supported. /// /// /// TXTBIT_VIEWINSETCHANGE /// If TRUE, the inset changed. /// /// /// TXTBIT_WORDWRAP /// /// If TRUE and TXTBIT_MULTILINE is also TRUE, multiline controls should wrap the line to the view rectangle. If this /// property is FALSE and TXTBIT_MULTILINE is TRUE, the lines should not be wrapped but clipped. The right side /// of the view rectangle should be ignored. If TXTBIT_MULTILINE is FALSE, this property has no effect. /// /// /// /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error Handling /// in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// /// The client rectangle is the rectangle that the text services object is responsible for painting and managing. The host relies on /// the text services object for painting that area. The text services object must not paint or invalidate areas outside of that /// rectangle. In addition, the host will forward mouse messages to the text services object when the cursor is over this rectangle. /// This rectangle is expressed in client coordinates of the containing window. /// /// /// The view inset is the amount of space on each side between the client rectangle and the view rectangle. The view rectangle (also /// called the Formatting rectangle) is the rectangle in which the text should be formatted. For more information, see TxGetViewInset. /// /// /// The backstyle is the style of the background of the client rectangle. It can be either TXTBACK_TRANSPARENT or TXTBACK_SOLID. See TXTBACKSTYLE. /// /// /// The scroll bar property indicates changes to the scroll bar: which scroll bar is present, whether scroll bars are hidden or /// disabled when scrolling is impossible, and also if auto-scrolling is enabled when the insertion point gets off the client rectangle. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxpropertybitschange HRESULT // OnTxPropertyBitsChange( [in] DWORD dwMask, [in] DWORD dwBits ); [PreserveSig] HRESULT OnTxPropertyBitsChange(TXTBIT dwMask, TXTBIT dwBits); /// /// Returns the cached drawing logical size (if any) that text services is using. Typically, this will be the size of the last client /// rectangle used in ITextServices::TxDraw, ITextServices::OnTxSetCursor, and so forth, although it is not guaranteed to be. /// /// /// Type: DWORD* /// The width, in client coordinates. /// /// /// Type: DWORD* /// The height (in client coordinates). /// /// /// Type: HRESULT /// If the method succeeds, the return value is an HRESULT code. /// /// /// This method can free the host from the need to maintain the cached drawing size information and the need to keep in synchronization. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetcachedsize HRESULT TxGetCachedSize( // [in] DWORD *pdwWidth, [in] DWORD *pdwHeight ); [PreserveSig] HRESULT TxGetCachedSize(out uint pdwWidth, out uint pdwHeight); } /// The ITextServices2 interface extends the ITextServices interface. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nl-textserv-itextservices2 [PInvokeData("textserv.h", MSDNShortId = "NL:textserv.ITextServices2")] [ComVisible(true), Guid("8D33F741-CF58-11CE-A89D-00AA006CADC5"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITextServices2 : ITextServices { /// Used by the window host to forward messages sent from its window to the text services object. /// /// Type: UINT /// The message identifier. /// /// /// Type: WPARAM /// The WPARAM from the window's message. /// /// /// Type: LPARAM /// The LPARAM from the window's message. /// /// /// Type: LRESULT* /// The message's return LRESULT. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is one of the following HRESULT codes. For more information on COM error codes, see /// Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_OUTOFMEMORY /// Insufficient memory. NOERROR Message was processed, and some action was taken. /// /// /// S_FALSE /// /// Message was not processed. Typically indicates that the caller should process the message itself, potentially by calling DefWindowProc. /// /// /// /// S_MSG_KEYIGNORED /// Message processed, but no action was taken for the keystroke. /// /// /// /// /// /// Note that two return values are passed back from this function. The return value that should be passed back from a window /// procedure is plresult. However, in some cases, the returned LRESULT does not contain enough information. For /// example, to implement moving the cursor around controls, it's useful to know if a keystroke (such as right arrow) was processed /// but ignored (for example, the caret is already at the rightmost position in the text). In these cases, more information may be /// returned through the returned HRESULT. /// /// /// WM_CHAR and WM_KEYDOWN should return the value S_MSG_KEYIGNORED when a key or character is recognized, but has no effect, given /// the current state. For example, S_MSG_KEYIGNORED should be returned in the following cases: /// /// /// /// /// Any keystroke that tries to move the insertion point to or beyond the beginning or the end of the document; when it is already at /// the beginning or end of the document, respectively. /// /// /// /// /// Any keystroke that tries to move the insertion point to or past the next line when it is already on the last line; or to or /// before the previous line when it is already on the first line. /// /// /// /// /// Any insertion of the character from WM_CHAR that would move the insertion point past the maximum length of the control. /// /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txsendmessage HRESULT TxSendMessage( UINT // msg, WPARAM wparam, LPARAM lparam, LRESULT *plresult ); [PreserveSig] new HRESULT TxSendMessage(uint msg, IntPtr wparam, IntPtr lparam, out IntPtr plresult); /// Draws the text services object. /// /// Type: DWORD /// /// Specifies the aspect to be drawn, that is, how the object is to be represented. Draw aspect can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// /// Renders a screen image of the text content to the hdcDraw device context. The hicTargetDev and ptd /// parameters give information on the target device context if any (usually a printer). /// /// /// /// DVASPECT_DOCPRINT /// /// Renders the object to the hdcDraw device context as though it were printed to a printer. Thus, the text services object /// can optimize for the printer (for example, not painting the background color, if white). Also, certain screen-specific elements /// (such as the selection) should not be rendered. ITextServices::TxDraw should render the lprcBounds rectangle, /// starting at the current scrolling position. /// /// /// /// /// /// Type: LONG /// Not supported. /// /// /// Type: void* /// Information for drawing optimizations. /// /// /// Type: DVTARGETDEVICE* /// The target device. /// /// /// Type: HDC /// Rendering device context. /// /// /// Type: HDC /// Target information context. /// /// /// Type: LPCRECTL /// The bounding (client) rectangle. /// /// /// Type: LPCRECTL /// The clipping rectangle for metafiles. /// /// /// Type: LPRECT /// The update region inside lprcBounds. /// /// /// Type: BOOL CALLBACK* /// Not supported. /// /// /// Type: DWORD /// Parameter to pass to continue function. /// /// /// Type: LONG /// Specifies the view to draw. /// /// /// Value /// Meaning /// /// /// TXTVIEW_ACTIVE /// Draw the inplace active view. /// /// /// TXTVIEW_INACTIVE /// Draw a view other than the inplace active view; for example, a print preview. /// /// /// /// /// Type: HRESULT /// The return value is typically S_OK. /// /// /// /// This method renders the text services object. It accepts the same parameters as the corresponding IViewObject::Draw method in /// OLE, with the extra lprcUpdate and the lViewId parameters. It can be used while the host is in-place active or inactive. /// /// /// The lprcBounds parameter gives the rectangle to render, also called the client rectangle. This rectangle represents the /// position and extent of the entire image of the text services object to be drawn. It is expressed in the logical coordinate system /// of hdcDraw. If lprcBounds is NULL then the control must be active. In this case, the text services object /// should render the in-place active view (that is, the client rectangle that can be obtained by calling TxGetClientRect on the host). /// /// /// If the lprcUpdate parameter is not NULL, it gives the rectangle to update inside that client rectangle, in the /// logical coordinate system of hdcDraw. If lprcUpdate is NULL, the entire client rectangle should be painted. /// /// /// The text services object should render with the appropriate zoom factor, which can be obtained from the client rectangle and the /// native size given by TxGetExtent. For a discussion of the zoom factor, see TxGetExtent. /// /// General comments on OLE hosts and ITextServices::TxDraw (also for ITextServices::OnTxSetCursor, and ITextServices::TxQueryHitPoint): /// /// An OLE host can call the ITextServices::TxDraw method at any time with any rendering device context or client rectangle. /// An OLE object that is inactive only retains an extent. To get the rectangle in which to render, the host calls the /// IViewObject::Draw method. This rectangle is valid only for the scope of that method. Thus, the same control can be rendered /// consecutively in different rectangles and different device contexts, for example, because it is displayed simultaneously in /// different views on the screen. /// /// /// Normally, the client rectangle and device context passed to ITextServices::TxDraw should not be cached, because this would /// force the text services object to recalculate lines for every draw, which would impede performance. Instead, the text services /// object could cache the information that is computed for a specific client rectangle and device context (such as line breaks). On /// the next call to ITextServices::TxDraw, however, the validity of the cached information should be checked before it gets /// used, and updated information should be regenerated, if necessary. /// /// /// Also, take great care when the control is in-place active. This problem is even more complex since ITextServices::TxDraw /// can still be called to render other views than the one that is in-place active. In other words, the client rectangle passed to /// ITextServices::TxDraw may not be the same as the active one (passed to ITextServices::OnTxInPlaceActivate and obtained /// through TxGetClientRect on the host). /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txdraw HRESULT TxDraw( [in] DWORD // dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] LPCRECTL // lprcBounds, [in] LPCRECTL lprcWBounds, [in] LPRECT lprcUpdate, BOOL(* )(DWORD) pfnContinue, DWORD dwContinue, LONG lViewId ); [PreserveSig] new HRESULT TxDraw(DVASPECT dwDrawAspect, int lindex, IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcBounds, in RECT lprcWBounds, in RECT lprcUpdate, IntPtr pfnContinue, uint dwContinue, TXTVIEW lViewId); /// Returns horizontal scroll bar information. /// /// Type: LONG* /// The minimum scroll position. /// /// /// Type: LONG* /// The maximum scroll position. /// /// /// Type: LONG* /// The current scroll position. /// /// /// Type: LONG* /// The view width, in pixels. /// /// /// Type: BOOL* /// Indicates whether horizontal scrolling is enabled. If TRUE, horizontal scrolling is enabled. /// /// /// Type: HRESULT /// The method always returns S_OK. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgethscroll HRESULT TxGetHScroll( LONG // *plMin, LONG *plMax, LONG *plPos, LONG *plPage, BOOL *pfEnabled ); [PreserveSig] new HRESULT TxGetHScroll(out int plMin, out int plMax, out int plPos, out int plPage, out bool pfEnabled); /// Returns vertical scroll bar state information. /// /// Type: LONG* /// The minimum scroll position. /// /// /// Type: LONG* /// The maximum scroll position. /// /// /// Type: LONG* /// The current scroll position. /// /// /// Type: LONG* /// The height of view in pixels. /// /// /// Type: BOOL* /// /// Indicates whether the vertical scroll bar is enabled. If TRUE, the vertical scroll bar is enabled; otherwise it is disabled. /// /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is one of the following HRESULT codes. For more information on COM error codes, see /// Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unspecified error. /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetvscroll HRESULT TxGetVScroll( LONG // *plMin, LONG *plMax, LONG *plPos, LONG *plPage, BOOL *pfEnabled ); [PreserveSig] new HRESULT TxGetVScroll(out int plMin, out int plMax, out int plPos, out int plPage, out bool pfEnabled); /// Notifies the text services object to set the cursor. /// /// Type: DWORD /// Draw aspect can be one of the following values. /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// /// Renders a screen image of the text content to the hdcDraw device context. The hicTargetDev and ptd /// parameters give information on the target device context if any (usually a printer). /// /// /// /// DVASPECT_DOCPRINT /// /// Renders the object to the hdcDraw device context as though it were printed to a printer. Thus, the text services object /// can optimize for the printer (for example, not painting the background color, if white). Also, certain screen-specific elements /// (such as the selection) should not be rendered. ITextServices::OnTxSetCursor should render the lprcClient /// rectangle, starting at the current scrolling position. /// /// /// /// /// /// Type: LONG /// Not supported. /// /// /// Type: void* /// Information for drawing optimizations. /// /// /// Type: DVTARGETDEVICE* /// The target device. /// /// /// Type: HDC /// Rendering device context. /// /// /// Type: HDC /// Target information context. /// /// /// Type: LPCRECT /// /// The control's client rectangle. The coordinates of the rectangle are in client coordinates of the containing window. NULL /// is a legal value. /// /// /// /// Type: INT /// x position of cursor, in the client coordinates of the containing window. /// /// /// Type: INT /// y position of cursor, in the client coordinates of the containing window. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// One or more illegal parameters. /// /// /// /// /// /// The text services object may remeasure as a result of this call to determine the correct cursor. The correct cursor is set /// through TxSetCursor. /// /// /// The lprcClient parameter is the client rectangle of the view of the control over which the mouse cursor is positioned. The /// lprcClient parameter is in device coordinates of the containing window in the same way the WM_SIZE message is. This may /// not be the view that was rendered last. Furthermore, if the control is in-place active, this may not be the current active view . /// As a consequence, the text services object should check this rectangle against its current cache's value and determine whether /// recalculating the lines is necessary or not. The zoom factor should be included in this computation. For a discussion of the zoom /// factor, see TxGetExtent. /// /// /// This method should be called only for screen views of the control. Therefore the device context (DC) is not passed in, but should /// be assumed to be a screen DC. /// /// For more information, see the Remarks in ITextServices::TxDraw. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxsetcursor HRESULT OnTxSetCursor( [in] // DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] // LPCRECT lprcClient, [in] INT x, [in] INT y ); [PreserveSig] new HRESULT OnTxSetCursor(uint dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y); /// Tests whether a specified point is within the rectangle of the text services object. /// /// Type: DWORD /// Draw aspect can be one of the following values. /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// /// Renders a screen image of the text content to the hdcDraw device context. The hicTargetDev and ptd /// parameters give information on the target device context if any (usually a printer). /// /// /// /// DVASPECT_DOCPRINT /// /// Renders the object to the hdcDraw device context as though it were printed to a printer. Thus, the text services object /// can optimize for the printer (for example, not painting the background color, if white). Also, certain screen-specific elements /// (such as the selection) should not be rendered. ITextServices::TxGetNaturalSize should render the lprcClient rectangle, /// starting at the current scrolling position. /// /// /// /// /// /// Type: LONG /// Not supported. /// /// /// Type: void* /// Information for drawing optimizations. /// /// /// Type: DVTARGETDEVICE* /// Information on the target device. /// /// /// Type: HDC /// Rendering device context. /// /// /// Type: HDC /// Target information context. /// /// /// Type: LPCRECT /// The control's client rectangle, in client (device) coordinates of the view in which the hit testing is done. /// /// /// Type: INT /// x-coordinate to check, in client coordinates, of the view in which hit testing is done. /// /// /// Type: INT /// y-coordinate to check, in client coordinates, of the view in which hit testing is done. /// /// /// Type: DWORD* /// The result of the hit test. It can be any of the following TXTHITRESULT enumeration values. /// /// /// Value /// Meaning /// /// /// TXTHITRESULT_CLOSE /// The point is in the client rectangle and close to a nontransparent area. /// /// /// TXTHITRESULT_HIT /// The point is in the client rectangle and either over text or the background is not transparent. /// /// /// TXTHITRESULT_NOHIT /// The point is outside of the client rectangle. /// /// /// TXTHITRESULT_TRANSPARENT /// The point is in the client rectangle and either not over text or the background was transparent. /// /// /// /// /// Type: HRESULT /// The return value is an HRESULT code. /// /// /// This method allows the host to implement transparent hit testing on text. /// For more information, see the Remarks section in ITextServices::TxDraw and ITextServices::OnTxSetCursor. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txqueryhitpoint HRESULT TxQueryHitPoint( // [in] DWORD dwDrawAspect, LONG lindex, [in] void *pvAspect, [in] DVTARGETDEVICE *ptd, [in] HDC hdcDraw, [in] HDC hicTargetDev, [in] // LPCRECT lprcClient, [in] INT x, [in] INT y, [out] DWORD *pHitResult ); [PreserveSig] new HRESULT TxQueryHitPoint(DVASPECT dwDrawAspect, int lindex, [In] IntPtr pvAspect, [In] DVTARGETDEVICE ptd, [In] HDC hdcDraw, [In] HDC hicTargetDev, in RECT lprcClient, int x, int y, out uint pHitResult); /// Notifies the text services object that this control is in-place active. /// /// Type: const RECT* /// The control's client rectangle. /// /// /// Type: HRESULT /// If the object is successfully activated, the return value is S_OK. /// /// If the object could not be activated due to error, the return value is E_FAIL. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// /// In-place active means that an embedded object is running in-place (for example, for regular controls and embeddings, it /// would have a window to draw in). In contrast, UI active means that an object currently has the editing focus. For example, /// things like menus and toolbars on the container may also contain elements from the UI-active control/embedding. There is only one /// UI-active control at any given time, while there can be many in-place active controls. /// /// /// Note, UI activation is different from getting the focus. To signal the text services object that the control is getting or losing /// focus, the host sends WM_SETFOCUS and WM_KILLFOCUS messages. Also, note that a windowless host will pass NULL as the /// wParam (window that lost the focus) for these messages. /// /// /// When making the transition directly from a nonactive state to the UI-active state, the host should call /// ITextServices::OnTxInPlaceActivate first and then ITextServices::OnTxUIActivate. /// /// /// ITextServices::OnTxInPlaceActivate takes as a parameter the client rectangle of the view being activated. This rectangle /// is given in client coordinates of the containing window. It is the same as would be obtained by calling TxGetClientRect on the host. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxinplaceactivate HRESULT // OnTxInPlaceActivate( [in] LPCRECT prcClient ); [PreserveSig] new HRESULT OnTxInPlaceActivate(in RECT prcClient); /// Notifies the text services object that this control is no longer in-place active. /// /// Type: HRESULT /// The return value is always S_OK. /// /// /// /// In-place activation refers to an embedded object running in-place (for example, for regular controls and embeddings, it /// would have a window to draw in). In contrast, UI active means that an object currently has the editing focus. /// Specifically, things like menus and toolbars on the container may also contain elements from the UI-active control/embedding. /// There can only be one UI-active control at any given time, while many can be in-place active at once. /// /// /// Note, UI activation is different from getting the focus. To let the text services object know that the control is getting or /// losing focus, the host will send WM_SETFOCUS and WM_KILLFOCUS messages. Also, note that a windowless host will pass NULL /// as the wParam (window that lost the focus) for these messages. /// /// /// When making the transition from the UI-active state to a nonactive state, the host should call ITextServices::OnTxUIDeactivate /// first and then ITextServices::OnTxInPlaceDeactivate. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxinplacedeactivate HRESULT OnTxInPlaceDeactivate(); [PreserveSig] new HRESULT OnTxInPlaceDeactivate(); /// Informs the text services object that the control is now UI active. /// /// Type: HRESULT /// The method always returns S_OK. /// /// See ITextServices::OnTxInPlaceActivate for a detailed description of activation. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxuiactivate HRESULT OnTxUIActivate(); [PreserveSig] new HRESULT OnTxUIActivate(); /// Informs the text services object that the control is no longer UI active. /// /// Type: HRESULT /// The method always returns S_OK. /// /// See ITextServices::OnTxInPlaceActivate for a detailed description of deactivation. // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxuideactivate HRESULT OnTxUIDeactivate(); [PreserveSig] new HRESULT OnTxUIDeactivate(); /// Returns all of the Unicode plain text in the control as a BSTR. /// /// Type: BSTR * /// The Unicode plain text. /// /// /// Type: HRESULT /// If the text is successfully returned in the output argument, the return value is S_OK. /// /// If the method fails, the return value is one of the following HRESULT codes. For more information on COM error codes, see /// Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// Invalid BSTR pointer passed in. /// /// /// E_OUTOFMEMORY /// Could not allocate memory for copy of the text. /// /// /// /// /// The host (caller) takes ownership of the returned BSTR. /// Other ways to retrieve plain text data are to use WM_GETTEXT or the Text Object Model (TOM) GetText method. /// If there is no text in the control, the BSTR is allocated and 0x000D is returned in it. /// The returned text will not necessarily be null-terminated. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgettext HRESULT TxGetText( BSTR // *pbstrText ); [PreserveSig] new HRESULT TxGetText([MarshalAs(UnmanagedType.BStr)] out string pbstrText); /// Sets all of the text in the control. /// /// Type: LPCTSTR /// The string which will replace the current text. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Text could not be updated. /// /// /// /// /// /// This method should be used with care; it essentially reinitializes the text services object with some new data. Any previous data /// and formatting information will be lost, including undo information. /// /// /// If previous data has been copied to the clipboard, that data will be rendered completely to the clipboard (through /// OleFlushClipboard) before it is discarded. /// /// This method does not support Undo. /// Two alternate approaches to setting text are WM_SETTEXT and SetText. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txsettext HRESULT TxSetText( [in] LPCWSTR // pszText ); [PreserveSig] new HRESULT TxSetText([MarshalAs(UnmanagedType.LPWStr)] string pszText); /// Gets the target x position, that is, the current horizontal position of the caret. /// /// /// Type: HRESULT /// If the x position of the caret is returned, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// There is no selection. /// /// /// E_INVALIDARG /// The input argument is invalid. /// /// /// /// /// /// Together with ITextServices::OnTxSetCursor, this method allows you to maintain the horizontal caret position when moving the /// caret up and down. This capability is useful when moving the caret through forms. /// /// /// The target caret position is expressed as an x-coordinate on the display because other controls do not necessarily share the same /// attributes for column position. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetcurtargetx HRESULT TxGetCurTargetX( // LONG *unnamedParam1 ); [PreserveSig] new HRESULT TxGetCurTargetX(out int unnamedParam1); /// /// Gets the base line position of the first visible line, in pixels, relative to the text services client rectangle. This permits /// aligning controls on their base lines. /// /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error /// Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetbaselinepos HRESULT TxGetBaseLinePos( // LONG *unnamedParam1 ); [PreserveSig] new HRESULT TxGetBaseLinePos(out int unnamedParam1); /// Allows a control to be resized so it fits its content appropriately. /// /// Type: DWORD /// The aspect for the drawing. It can be any of the values from the DVASPECT enumeration. /// /// /// Type: HDC /// The device context into which drawing occurs. /// /// /// Type: HDC /// The device context for which text should be formatted (that is, for WYSIWYG). /// /// /// Type: DVTARGETDEVICE* /// More information on the target device. /// /// /// Type: DWORD /// The type of fitting requested. It can be one of the following. /// /// /// Value /// Meaning /// /// /// TXTNS_EMU /// Use English Metric Units (EMUs) instead of pixels as the measuring units for this method's parameters. /// /// /// TXTNS_FITTOCONTENT /// /// Resize the control to fit the entire text by formatting the text to the width that is passed in. The text services object returns /// the height of the entire text and the width of the widest line. For example, this should be done when the user double-clicks one /// of the control's handles. /// /// /// /// TXTNS_FITTOCONTENT2 /// Resize the control so that it fits indented content. /// /// /// TXTNS_FITTOCONTENT3 /// Resize the control so that it fits indented content and trailing whitespace. /// /// /// TXTNS_FITTOCONTENTWSP /// Resize the control so that it fits unindented content and trailing whitespace. /// /// /// TXTNS_INCLUDELASTLINE /// For a plain-text control, include the height of the final carriage return when calculating the size. /// /// /// TXTNS_ROUNDTOLINE /// /// Resize the control to show an integral number of lines (no line is clipped). Format enough text to fill the width and height that /// is passed in, and then return a height that is rounded to the nearest line boundary. /// /// /// /// /// /// Type: const SIZEL* /// Not supported. /// /// /// Type: LONG* /// The width for the fitting defined by dwMode. /// /// /// Type: LONG* /// The height for the fitting defined by dwMode. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If text services could not activate the object, the return value is one of the following HRESULT codes. For more /// information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unable to determine correct size. /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_OUTOFMEMORY /// Insufficient memory. /// /// /// /// /// /// The first four parameters are similar to equivalent parameters in ITextServices::TxDraw and give the same information. In the /// case where the lines must be recalculated, it should use these values the same ways as in ITextServices::TxDraw. /// /// /// The pwidth and pheight parameters are in/out parameters. The host passes in the tentative width and height of the /// natural extent of the text object. The text services object compares these values against its current cached state, and if /// different, recalculate lines. Then, it computes and returns the natural size, as specified by dwMode. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetnaturalsize HRESULT TxGetNaturalSize( // DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, const SIZEL *psizelExtent, [in, out] LONG // *pwidth, [in, out] LONG *pheight ); [PreserveSig] new HRESULT TxGetNaturalSize(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, [In] DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight); /// Gets the drop target for the text control. /// /// Type: IDropTarget** /// The target of a drag-and-drop operation in a specified window. /// /// /// Type: HRESULT /// If the method got the drop target successfully, the return value is S_OK. /// For more information on COM error codes, see Error Handling in COM. /// /// /// Return code /// Description /// /// /// E_OUTOFMEMORY /// Could not create the drop target. /// /// /// /// /// The host (caller) is responsible for calling RegisterDragDrop or RevokeDragDrop, and for calling Release on the returned drop /// target when done. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetdroptarget HRESULT TxGetDropTarget( // IDropTarget **ppDropTarget ); [PreserveSig] new HRESULT TxGetDropTarget(out IDropTarget ppDropTarget); /// Sets properties (represented by bits) for the control. /// /// Type: DWORD /// Bits representing properties to be changed. For the possible bit values, see the TXTBIT_* values list in dwBits. /// /// /// Type: DWORD /// New values for bit properties. It can be any combination of the following. /// /// /// Value /// Meaning /// /// /// TXTBIT_ALLOWBEEP /// If TRUE, beeping is enabled. /// /// /// TXTBIT_AUTOWORDSEL /// If TRUE, the AutoWordSelect feature is enabled. /// /// /// TXTBIT_BACKSTYLECHANGE /// If TRUE, the backstyle changed. See TxGetBackStyle. /// /// /// TXTBIT_CHARFORMATCHANGE /// If TRUE, the character format changed. /// /// /// TXTBIT_CLIENTRECTCHANGE /// If TRUE, the client rectangle changed. /// /// /// TXTBIT_DISABLEDRAG /// If TRUE, dragging is disabled. /// /// /// TXTBIT_D2DDWRITE /// Use Direct2D/DirectWrite for this instance, and not GDI/Uniscribe. /// /// /// TXTBIT_D2DPIXELSNAPPED /// Render glyphs to the nearest pixel positions. Valid only if D2DDWRITE is set. /// /// /// TXTBIT_D2DSUBPIXELLINES /// /// Draw lines with subpixel precision. Don't pixel-snap text lines, underline, and strikethrough in the secondary text flow /// direction (usually vertical). Valid only if D2DDWRITE is set and D2DPIXELSNAPPED is not set. /// /// /// /// TXTBIT_D2DSIMPLETYPOGRAPHY /// /// Render text using simple typography (no glyph rendering). This value is valid only if TXTBIT_D2DDWRITE is also specified. /// /// /// /// TXTBIT_EXTENTCHANGE /// If TRUE, the size of the client rectangle changed. /// /// /// TXTBIT_HIDESELECTION /// /// If TRUE, the text services object should hide the selection when the control is inactive. If FALSE, the selection /// should be displayed when the control is inactive. Note, this implies TXTBIT_SAVESELECTION is TRUE. /// /// /// /// TXTBIT_MAXLENGTHCHANGE /// If TRUE, the maximum length for text in the control changed. /// /// /// TXTBIT_MULTILINE /// /// If TRUE, the text services object should work in multiline mode. Use the TXTBIT_WORDWRAP value to determine whether /// to wrap the lines to the view rectangle or clip them. If FALSE, the text services object should not process a carriage /// return/line feed from the ENTER key and it should truncate incoming text containing hard line breaks just before the first line /// break. It is also acceptable to truncate text that is set with ITextServices::TxSetText, because it is the responsibility of the /// host not to use a single-line control when bound to a multiline field. /// /// /// /// TXTBIT_NOTHREADREFCOUNT /// Don't reference TLS data on behalf of this instance. /// /// /// TXTBIT_PARAFORMATCHANGE /// If TRUE, the paragraph format changed. /// /// /// TXTBIT_READONLY /// /// If TRUE, the text services object should not accept any editing change through the user interface. However, it should /// still accept programmatic changes through EM_SETTEXTEX, EM_REPLACESEL, and ITextServices::TxSetText. Also, the user should still /// be able to move the insertion point, select text, and carry out other operations that don't modify content, such as Copy. /// /// /// /// TXTBIT_RICHTEXT /// /// If TRUE, the text services object should be in rich-text mode. If FALSE, it is in plain-text mode. Note, this /// affects how editing commands are applied. For example, applying bold to part of the text in a plain-edit control makes the entire /// text bold. However, for a rich-edit control, this makes only the selected text bold. /// /// /// /// TXTBIT_SAVESELECTION /// /// If TRUE, the boundaries of the selection should be saved when the control is inactive. If FALSE, when the control /// goes active again the selection boundaries can be reset to start = 0, length = 0. /// /// /// /// TXTBIT_SCROLLBARCHANGE /// If TRUE, the scroll bar has changed. /// /// /// TXTBIT_SELBARCHANGE /// If TRUE, the selection bar width has changed /// /// /// TXTBIT_SHOWACCELERATOR /// If set, the accelerator character should be underlined. This must be set in order to call TxGetAcceleratorPos. /// /// /// TXTBIT_SHOWPASSWORD /// Show password strings. /// /// /// TXTBIT_USECURRENTBKG /// Not supported. /// /// /// TXTBIT_USEPASSWORD /// /// If TRUE, display text using the password character obtained by TxGetPasswordChar. The notification on this property can /// mean either that the password character changed or that the password character was not used before but is used now (or vice versa). /// /// /// /// TXTBIT_VERTICAL /// Not supported. /// /// /// TXTBIT_VIEWINSETCHANGE /// If TRUE, the inset changed. /// /// /// TXTBIT_WORDWRAP /// /// If TRUE and TXTBIT_MULTILINE is also TRUE, multiline controls should wrap the line to the view rectangle. If this /// property is FALSE and TXTBIT_MULTILINE is TRUE, the lines should not be wrapped but clipped. The right side /// of the view rectangle should be ignored. If TXTBIT_MULTILINE is FALSE, this property has no effect. /// /// /// /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error Handling /// in COM. /// /// /// /// Return code /// Description /// /// /// E_NOTIMPL /// Not implemented. /// /// /// /// /// /// The client rectangle is the rectangle that the text services object is responsible for painting and managing. The host relies on /// the text services object for painting that area. The text services object must not paint or invalidate areas outside of that /// rectangle. In addition, the host will forward mouse messages to the text services object when the cursor is over this rectangle. /// This rectangle is expressed in client coordinates of the containing window. /// /// /// The view inset is the amount of space on each side between the client rectangle and the view rectangle. The view rectangle (also /// called the Formatting rectangle) is the rectangle in which the text should be formatted. For more information, see TxGetViewInset. /// /// /// The backstyle is the style of the background of the client rectangle. It can be either TXTBACK_TRANSPARENT or TXTBACK_SOLID. See TXTBACKSTYLE. /// /// /// The scroll bar property indicates changes to the scroll bar: which scroll bar is present, whether scroll bars are hidden or /// disabled when scrolling is impossible, and also if auto-scrolling is enabled when the insertion point gets off the client rectangle. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-ontxpropertybitschange HRESULT // OnTxPropertyBitsChange( [in] DWORD dwMask, [in] DWORD dwBits ); [PreserveSig] new HRESULT OnTxPropertyBitsChange(TXTBIT dwMask, TXTBIT dwBits); /// /// Returns the cached drawing logical size (if any) that text services is using. Typically, this will be the size of the last client /// rectangle used in ITextServices::TxDraw, ITextServices::OnTxSetCursor, and so forth, although it is not guaranteed to be. /// /// /// Type: DWORD* /// The width, in client coordinates. /// /// /// Type: DWORD* /// The height (in client coordinates). /// /// /// Type: HRESULT /// If the method succeeds, the return value is an HRESULT code. /// /// /// This method can free the host from the need to maintain the cached drawing size information and the need to keep in synchronization. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices-txgetcachedsize HRESULT TxGetCachedSize( // [in] DWORD *pdwWidth, [in] DWORD *pdwHeight ); [PreserveSig] new HRESULT TxGetCachedSize(out uint pdwWidth, out uint pdwHeight); /// /// Resizes a control so it fits its content appropriately. This method is similar to TxGetNaturalSize, but also retrieves the ascent /// of the top line of text. /// /// /// Type: DWORD /// The aspect for the drawing. It can be any of the values from the DVASPECT enumeration. /// /// /// Type: HDC /// The device context into which drawing occurs. /// /// /// Type: HDC /// The device context for which text should be formatted (that is, for WYSIWYG). /// /// /// Type: DVTARGETDEVICE* /// More information on the target device. /// /// /// Type: DWORD /// The type of fitting requested. It can be one of the following. /// /// /// Value /// Meaning /// /// /// TXTNS_EMU /// Use English Metric Units (EMUs) instead of pixels as the measuring units (both ways) for this method's parameters. /// /// /// TXTNS_FITTOCONTENT /// /// Resize the control to fit the entire text by formatting the text to the width that is passed in. The text services object returns /// the height of the entire text and the width of the widest line. For example, this should be done when the user double-clicks one /// of the control's handles. /// /// /// /// TXTNS_FITTOCONTENT2 /// Resize the control so that it fits indented content. /// /// /// TXTNS_FITTOCONTENT3 /// Resize the control so that it fits indented content and trailing white space. /// /// /// TXTNS_FITTOCONTENTWSP /// Resize the control so that it fits unindented content and trailing white space. /// /// /// TXTNS_INCLUDELASTLINE /// For a plain-text control, include the height of the final carriage return when calculating the size. /// /// /// TXTNS_ROUNDTOLINE /// /// Resize the control to show an integral number of lines (no line is clipped). Format enough text to fill the width and height that /// is passed in, and then return a height that is rounded to the nearest line boundary. /// /// /// /// /// /// Type: const SIZEL* /// Sizes of extents (in HIMETRIC units) to use for zooming. /// /// /// Type: LONG* /// The width for the fitting defined by dwMode. /// /// /// Type: LONG* /// The height for the fitting defined by dwMode. /// /// /// Type: LONG* /// For single-line controls, receives the ascent (units above the baseline) of characters in the top line of text. /// /// /// Type: HRESULT /// If the method succeeds, the return value is S_OK. /// /// If text services could not activate the object, the return value is one of the following HRESULT codes. For more /// information on COM error codes, see Error Handling in COM. /// /// /// /// Return code /// Description /// /// /// E_FAIL /// Unable to determine correct size. /// /// /// E_INVALIDARG /// One or more arguments are not valid. /// /// /// E_OUTOFMEMORY /// Insufficient memory. /// /// /// /// /// /// The first four parameters are similar to equivalent parameters in ITextServices::TxDraw and give the same information. In the /// case where the lines must be recalculated, TxGetNaturalSize2 uses these values in the same ways as in ITextServices::TxDraw. /// /// /// The pwidth and pheight parameters are in/out parameters. The host passes in the tentative width and height of the /// natural extent of the text object. The text services object compares these values against its current cached state, and if /// different, recalculates lines. Then, it computes and returns the natural size, as specified by dwMode. /// /// Examples /// /// The following example shows how to initialize the psizelExtent parameter for to a zoom factor of 1:1. The ellipses /// indicate code that you need to provide. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices2-txgetnaturalsize2 HRESULT // TxGetNaturalSize2( DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, const SIZEL *psizelExtent, // LONG *pwidth, LONG *pheight, LONG *pascent ); [PreserveSig] HRESULT TxGetNaturalSize2(DVASPECT dwAspect, HDC hdcDraw, HDC hicTargetDev, [In] DVTARGETDEVICE ptd, TXTNATURALSIZE dwMode, in SIZE psizelExtent, ref int pwidth, ref int pheight, out int pascent); /// Draws the text services object by using Direct2D rendering. /// /// Type: ID2D1RenderTarget* /// The Direct2D rendering object that draws the text services object. /// /// /// Type: LPCRECTL /// The bounding (client) rectangle. /// /// /// Type: LPRECT /// /// The rectangle to update inside lprcBounds rectangle, in the logical coordinate system of drawing device context. If this /// parameter is NULL, the entire client rectangle should be drawn. /// /// /// /// Type: LONG /// The view to draw. /// /// /// Value /// Meaning /// /// /// TXTVIEW_ACTIVE /// Draw the in-place active view. /// /// /// TXTVIEW_INACTIVE /// Draw a view other than the in-place active view, for example, a print preview. /// /// /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-itextservices2-txdrawd2d HRESULT TxDrawD2D( // ID2D1RenderTarget *pRenderTarget, LPCRECTL lprcBounds, LPRECT lprcUpdate, LONG lViewId ); [PreserveSig] HRESULT TxDrawD2D([In, MarshalAs(UnmanagedType.IUnknown)] object /*ID2D1RenderTarget*/ pRenderTarget, in RECT lprcBounds, [In, Optional] PRECT lprcUpdate, TXTVIEW lViewId); } /// /// The CreateTextServices function creates an instance of a text services object. The text services object supports a variety of /// interfaces, including ITextServices and the Text Object Model (TOM). /// /// /// Type: IUnknown* /// /// Pointer to the controlling IUnknown interface on the outer object if the text services object is being created as part of an /// aggregate object. This parameter can be NULL if the object is not part of an aggregate. /// /// /// /// Type: ITextHost* /// Pointer to your implementation of the ITextHost interface. This pointer must not be NULL. /// /// /// Type: IUnknown** /// /// Pointer to a variable that receives a pointer to the private IUnknown of the text services object. You can call QueryInterface on /// this pointer to retrieve ITextServices or ITextDocument interface pointers. /// /// /// /// Type: HRESULT /// If the text services object was created successfully, the return value is S_OK. /// /// If the function fails, one of the following COM error codes are returned. For more information on COM error codes, see Error Handling /// in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// An invalid argument was passed in. /// /// /// E_OUTOFMEMORY /// Memory for text services object could not be allocated. /// /// /// E_FAIL /// The text services object could not be initialized. /// /// /// /// /// A text services object can be created as part of a standard COM-aggregated object. If it is, then callers should follow standard /// OLE32 rules for dealing with aggregated objects and caching interface pointers obtained through QueryInterface from the private IUnknown. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-createtextservices HRESULT CreateTextServices( [in] IUnknown // *punkOuter, [in] ITextHost *pITextHost, [out] IUnknown **ppUnk ); [PInvokeData("textserv.h", MSDNShortId = "NF:textserv.CreateTextServices")] [DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true)] public static extern HRESULT CreateTextServices([In, Optional, MarshalAs(UnmanagedType.IUnknown)] object punkOuter, [In] ITextHost pITextHost, [MarshalAs(UnmanagedType.IUnknown)] out object ppUnk); /// Disconnects a host from a text services instance. /// /// Type: IUnknown* /// A text services instance created by a previous call to the CreateTextServices function. /// /// /// Type: HRESULT /// If the text services object was created successfully, the return value is S_OK. /// /// If the function fails, one of the following COM error codes are returned. For more information on COM error codes, see Error Handling /// in COM. /// /// /// /// Return code /// Description /// /// /// E_INVALIDARG /// The pTextServices parameter is not valid. /// /// /// /// /// A host calls this function when the host is being freed. Calling this function is necessary because all text services instances /// maintain a host pointer for which the AddRef method has not been called. This function calls the Release method on the text services /// instance and, if this is not the last reference to the text services object, nulls out the host pointer in the text services object /// and prepares the control to handle failed operations that require host services. This function allows any other outstanding /// references to the text services object to work or fail gracefully depending on the service required. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/nf-textserv-shutdowntextservices HRESULT ShutdownTextServices( [in] // IUnknown *pTextServices ); [PInvokeData("textserv.h", MSDNShortId = "NF:textserv.ShutdownTextServices")] [DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true)] public static extern HRESULT ShutdownTextServices([In, MarshalAs(UnmanagedType.IUnknown)] object pTextServices); /// /// Contains information that is associated with an EN_CHANGE notification code. A windowless rich edit control sends this notification /// to its host window when the content of the control changes. /// // https://learn.microsoft.com/en-us/windows/win32/api/textserv/ns-textserv-changenotify struct CHANGENOTIFY { DWORD dwChangeType; void // *pvCookieData; }; [PInvokeData("textserv.h", MSDNShortId = "NS:textserv.CHANGENOTIFY")] [StructLayout(LayoutKind.Sequential)] public struct CHANGENOTIFY { /// /// The type of change that occurred. It can be one of the following values. /// /// /// Value /// Meaning /// /// /// CN_GENERIC /// No significant change occurred. /// /// /// CN_NEWREDO /// A new redo action was added. /// /// /// CN_NEWUNDO /// A new undo action was added. /// /// /// CN_TEXTCHANGED /// The text changed. /// /// /// public CN dwChangeType; /// Cookie for the undo action that is associated with the change. public IntPtr pvCookieData; } }