using System.Runtime.InteropServices.ComTypes; using static Vanara.PInvoke.User32; namespace Vanara.PInvoke; /// Items from the MsftEdit.dll. public static partial class MsftEdit { /// For Microsoft Rich Edit 4.1 (Msftedit.dll), specify MSFTEDIT_CLASS as the window class. public const string MSFTEDIT_CLASS = "RICHEDIT50W"; /// The rich edit 1.0 class. public const string RICHEDIT_CLASS10A = "RichEdit10"; /// For all previous versions, specify RICHEDIT_CLASS for the Rich Edit class name. public static readonly string RICHEDIT_CLASS = "RichEdit20" + (Marshal.SystemDefaultCharSize == 1 ? "A" : "W"); private const string Lib_msftedit = "msftedit.dll"; private const string Lib_Riched20 = "riched20.dll"; /// /// /// The AutoCorrectProc function is an application-defined callback function that is used with the EM_SETAUTOCORRECTPROC message. /// /// /// AutoCorrectProc is a placeholder for the application-defined function name. It provides application-defined automatic error /// correction for text entered into a rich edit control. /// /// /// /// Type: LANGID /// Language ID that identifies the autocorrect file to use for automatic correcting. /// /// /// Type: const WCHAR* /// Autocorrect candidate string. /// /// /// Type: WCHAR* /// Resulting autocorrect string, if the return value is not ATP_NOCHANGE. /// /// /// Type: LONG /// Count of characters in pszAfter. /// /// /// Type: LONG* /// Count of trailing characters in pszBefore to replace with pszAfter. /// /// /// Type: int /// Returns one or more of the following values. /// /// /// Return code/value /// Description /// /// /// ATP_NOCHANGE 0 /// No change. /// /// /// ATP_CHANGE 1 /// /// Change but don’t replace most delimiters, and don’t replace a span of unchanged trailing characters (preserves their formatting). /// /// /// /// ATP_NODELIMITER 2 /// Change but don’t replace a span of unchanged trailing characters. /// /// /// ATP_REPLACEALLTEXT 4 /// /// Replace trailing characters even if they are not changed (uses the same formatting for the entire replacement string). /// /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/nc-richedit-autocorrectproc AutoCorrectProc Autocorrectproc; int // Autocorrectproc( LANGID langid, const WCHAR *pszBefore, WCHAR *pszAfter, LONG cchAfter, LONG *pcchReplaced ) {...} [PInvokeData("richedit.h", MSDNShortId = "NC:richedit.AutoCorrectProc")] [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = false)] public delegate int AutoCorrectProc(LANGID langid, [MarshalAs(UnmanagedType.LPWStr)] string pszBefore, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszAfter, int cchAfter, ref int pcchReplaced); /// /// The EditStreamCallback function is an application defined callback function used with the EM_STREAMIN and EM_STREAMOUT /// messages. It is used to transfer a stream of data into or out of a rich edit control. The EDITSTREAMCALLBACK type defines a /// pointer to this callback function. EditStreamCallback is a placeholder for the application-defined function name. /// /// /// Type: DWORD_PTR /// /// Value of the dwCookie member of the EDITSTREAM structure. The application specifies this value when it sends the EM_STREAMIN /// or EM_STREAMOUT message. /// /// /// /// Type: LPBYTE /// /// Pointer to a buffer to read from or write to. For a stream-in (read) operation, the callback function fills this buffer with data to /// transfer into the rich edit control. For a stream-out (write) operation, the buffer contains data from the control that the callback /// function writes to some storage. /// /// /// /// Type: LONG /// Number of bytes to read or write. /// /// /// Type: LONG* /// Pointer to a variable that the callback function sets to the number of bytes actually read or written. /// /// /// Type: DWORD /// The callback function returns zero to indicate success. /// /// The callback function returns a nonzero value to indicate an error. If an error occurs, the read or write operation ends and the rich /// edit control discards any data in the pbBuff buffer. If the callback function returns a nonzero value, the rich edit control /// uses the dwError member of the EDITSTREAM structure to pass the value back to the application. /// /// /// /// /// When you send the EM_STREAMIN or EM_STREAMOUT message to a rich edit control, the pfnCallback member of the EDITSTREAM /// structure specifies a pointer to an EditStreamCallback function. The rich edit control repeatedly calls the function to /// transfer a stream of data into or out of the control. /// /// /// When you send the EM_STREAMIN or EM_STREAMOUT message, you specify a value for the dwCookie member of the EDITSTREAM /// structure. The rich edit control uses the dwCookie parameter to pass this value to your EditStreamCallback function. /// For example, you might use dwCookie to pass a handle to an open file. The callback function can then use the dwCookie /// handle to read from or write to the file. /// /// /// The control calls the callback function repeatedly, transferring a portion of the data with each call. The control continues to call /// the callback function until one of the following conditions occurs: /// /// /// /// The callback function returns a nonzero value. /// /// /// The callback function returns zero in the * pcb parameter. /// /// /// /// An error occurs that prevents the rich edit control from transferring data into or out of itself. Examples are out-of-memory /// situations, failure of a system function, or an invalid character in the read buffer. /// /// /// /// For a stream-in operation, the RTF code contains data specifying the end of an RTF block. /// /// /// /// For a stream-in operation on a single-line edit control, the callback reads in an end-of-paragraph character (CR, LF, VT, LS, or PS). /// /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/nc-richedit-editstreamcallback EDITSTREAMCALLBACK Editstreamcallback; // DWORD Editstreamcallback( [in] DWORD_PTR dwCookie, [in] LPBYTE pbBuff, [in] LONG cb, [in] LONG *pcb ) {...} [PInvokeData("richedit.h", MSDNShortId = "NC:richedit.EDITSTREAMCALLBACK")] [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = false)] public delegate uint EDITSTREAMCALLBACK([In] IntPtr dwCookie, [In] IntPtr pbBuff, int cb, ref int pcb); /// /// The EditWordBreakProcEx function is an application defined callback function used with the EM_SETWORDBREAKPROCEX message. It /// determines the character index of the word break or the character class and word-break flags of the characters in the specified text. /// The EDITWORDBREAKPROCEX type defines a pointer to this callback function. EditWordBreakProcEx is a placeholder for the /// application-defined function name. /// /// /// Type: char* /// /// Pointer to the text at the current position. If code specifies movement to the left, the text is in the elements /// pchText [–1] through pchText [- cchText], and pchText[0] is undefined. For all other actions, the text /// is in the elements pchText[0] through pchText[ cchText –1]. /// /// /// /// Type: LONG /// Number of characters in the buffer in the direction specified by code. /// /// /// Type: BYTE /// Character set of the text. /// /// /// /// Type: LONG /// The function returns a value based on the code parameter. /// /// /// Return code /// Description /// /// /// code parameter /// Return value /// /// /// WB_CLASSIFY /// Returns the character class and word-break flags of the character at the specified position. /// /// /// WB_ISDELIMITER /// /// Returns TRUE if the character at the specified position is a delimiter or FALSE if the character is not. /// /// /// /// All other values /// Returns the character index of the word break. /// /// /// /// /// /// An application must install the callback function by specifying the address of the callback function in an EM_SETWORDBREAKPROCEX message. /// /// /// For Microsoft Rich Edit 2.0 and later, Rich Edit no longer supports EditWordBreakProcEx. Users can send EM_SETWORDBREAKPROC /// to set EditWordBreakProc, which is now enhanced to support the passing of Unicode text. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/nc-richedit-editwordbreakprocex EDITWORDBREAKPROCEX Editwordbreakprocex; // LONG Editwordbreakprocex( [in] char *pchText, [in] LONG cchText, [in] BYTE bCharSet, INT action ) {...} [PInvokeData("richedit.h", MSDNShortId = "NC:richedit.EDITWORDBREAKPROCEX")] [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = false, CharSet = CharSet.Ansi)] [Obsolete("For Microsoft Rich Edit 2.0 and later, Rich Edit no longer supports EditWordBreakProcEx. Users can send EM_SETWORDBREAKPROC to set EditWordBreakProc, which is now enhanced to support the passing of Unicode text.")] public delegate int EDITWORDBREAKPROCEX(string pchText, int cchText, byte bCharSet, int action); /// /// The HyphenateProc function is an application–defined callback function used with the EM_SETHYPHENATEINFO message. It /// determines how hyphenation is done in a Microsoft Rich Edit control. /// /// /// Type: WCHAR* /// Pointer to the word to hyphenate. /// /// /// Type: LANGID /// Current language ID for the control. /// /// /// Type: LONG /// Index of the character in the passed string that exceeds the line width. /// /// /// Type: HYPHRESULT* /// Pointer to a HYPHRESULT structure that HyphenateProc fills in with the result of the hyphenation. /// /// None /// /// HyphenateProc is a placeholder for the application-defined function name. /// /// An application must install the callback function by specifying the address of the callback function in an EM_SETHYPHENATEINFO message. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/nf-richedit-hyphenateproc void HyphenateProc( [in] WCHAR *pszWord, [in] // LANGID langid, [in] long ichExceed, [out] HYPHRESULT *phyphresult ); [PInvokeData("richedit.h", MSDNShortId = "NF:richedit.HyphenateProc")] [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = false, CharSet = CharSet.Unicode)] public delegate void HyphenateProc(string pszWord, LANGID langid, long ichExceed, out HYPHRESULT phyphresult); /// Specify 0 to disable automatic link detection, or one of the following values to enable various kinds of detection. [PInvokeData("richedit.h")] [Flags] public enum AURL : ushort { /// Windows 8: Recognize URLs that include the path. AURL_ENABLEURL = 1, /// Windows 8: Recognize email addresses. AURL_ENABLEEMAILADDR = 2, /// Windows 8: Recognize telephone numbers. AURL_ENABLETELNO = 4, /// Recognize URLs that contain East Asian characters. AURL_ENABLEEAURLS = 8, /// Windows 8: Recognize file names that have a leading drive specification, such as c:\temp. AURL_ENABLEDRIVELETTERS = 16, /// /// Windows 8: Disable recognition of domain names that contain labels with characters belonging to more than one of the following /// scripts: Latin, Greek, and Cyrillic. /// AURL_DISABLEMIXEDLGC = 32, } /// /// A set of flags that indicate the desired or current state of the effects flags. Obsolete bits are valid only for the bidirectional /// version of Rich Edit 1.0. /// [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._bidioptions")] [Flags] public enum BOE : ushort { /// /// If this flag is 1, context paragraph alignment is active. This feature is used only for plain-text controls. When active, the /// paragraph alignment is set to PFA_LEFT if the first strongly directional character is LTR, or PFA_RIGHT if the first strongly /// directional character is RTL. If the control has no strongly directional character, the alignment is chosen according to the /// directionality of the keyboard language when the control regains focus (default: 0). /// BOE_CONTEXTALIGNMENT = 0x0004, /// /// If this flag is 1, context paragraph directionality is active. This feature is used only for plain-text controls. When active, /// the paragraph directionality effect PFE_RTLPARA is set to 0 if the first strongly directional character is LTR, or 1 if the first /// strongly directional character is RTL. If the control has no strongly directional character, the directionality is chosen /// according to the directionality of the keyboard language when the control regains focus (default: 0). /// BOE_CONTEXTREADING = 0x0002, /// Windows 8: Force the rich edit control to recalculate the bidirectional information, and then redraw the control. BOE_FORCERECALC = 0x0008, /// /// Causes the plus and minus characters to be treated as neutral characters with no implied direction. Also causes the slash /// character to be treated as a common separator. /// BOE_LEGACYBIDICLASS = 0x0010, /// If this flag is 1, the characters !"#&'()*+,-./:;<=> are treated as strong LTR characters (default: 0). BOE_NEUTRALOVERRIDE = 0x0001, /// Uses plain text layout (obsolete). BOE_PLAINTEXT = 0x0000, /// Default paragraph direction—implies alignment (obsolete). BOE_RTLDIR = 0x0000, /// /// If this flag is 1, the Unicode Bidi Algorithm (UBA) is used for rich-text controls. The UBA is always used for plain-text /// controls (default: 0). /// BOE_UNICODEBIDI = 0x0020, } /// A set of mask bits that determine which of the wEffects flags will be set to 1 or 0 by the rich edit control. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._bidioptions")] [Flags] public enum BOM : ushort { /// The BOE_CONTEXTALIGNMENT value is valid. BOM_CONTEXTALIGNMENT = 0x0010, /// The BOE_CONTEXTREADING value is valid. BOM_CONTEXTREADING = 0x0008, /// The BOE_RTLDIR value is valid. BOM_DEFPARADIR = 0x0001, /// The BOE_LEGACYBIDICLASS value is valid. BOM_LEGACYBIDICLASS = 0x0040, /// The BOE_NEUTRALOVERRIDE value is valid. BOM_NEUTRALOVERRIDE = 0x0004, /// The BOE_PLAINTEXT value is valid. (obsolete). BOM_PLAINTEXT = 0x0002, /// The BOE_UNICODEBIDI value is valid. BOM_UNICODEBIDI = 0x0080, } /// /// A set of bit flags that specify character effects. Some of the flags are included only for compatibility with Microsoft Text Object /// Model (TOM) interfaces; the rich edit control stores the value but does not use it to display text. /// [Flags] public enum CFE : uint { /// /// Characters are all capital letters. The value does not affect the way the control displays the text. This value applies only to /// versions earlier than Microsoft Rich Edit 3.0. /// CFE_ALLCAPS = CFM.CFM_ALLCAPS, /// /// The background color is the return value of GetSysColor(COLOR_WINDOW). If this flag is set, crBackColor member is ignored. /// CFE_AUTOBACKCOLOR = CFM.CFM_BACKCOLOR, /// /// The text color is the return value of GetSysColor(COLOR_WINDOWTEXT). If this flag is set, the crTextColor member is ignored. /// CFE_AUTOCOLOR = 0x40000000, /// Characters are bold. CFE_BOLD = 0x00000001, /// Characters are displayed with a shadow that is offset by 3/4 point or one pixel, whichever is larger. CFE_DISABLED = CFM.CFM_DISABLED, /// Characters are embossed. The value does not affect how the control displays the text. CFE_EMBOSS = CFM.CFM_EMBOSS, /// /// The characters are less common members of a script. A font that supports a script should check if it has glyphs for such characters. /// CFE_EXTENDED = 0x02000000, /// /// Font is chosen by the rich edit control because the active font doesn’t support the characters. This process is called font binding. /// CFE_FONTBOUND = 0x00100000, /// For Microsoft Rich Edit 3.0 and later, characters are not displayed. CFE_HIDDEN = CFM.CFM_HIDDEN, /// Characters are displayed as imprinted characters. The value does not affect how the control displays the text. CFE_IMPRINT = CFM.CFM_IMPRINT, /// Characters are italic. CFE_ITALIC = 0x00000002, /// /// A rich edit control can send EN_LINK notification codes when it receives mouse messages while the mouse pointer is over text with /// the CFE_LINK effect. /// CFE_LINK = 0x00000020, /// Characters are part of a friendly name link. CFE_LINKPROTECTED = 0x00800000, /// Characters are in a math zone. CFE_MATH = 0x10000000, /// /// Characters do not participate in a math build up. For example, when applied to a /, the / will not be used to build up a fraction. /// CFE_MATHNOBUILDUP = 0x08000000, /// Characters are displayed as ordinary text within a math zone. CFE_MATHORDINARY = 0x20000000, /// Characters are displayed as outlined characters. The value does not affect how the control displays the text. CFE_OUTLINE = CFM.CFM_OUTLINE, /// Characters are protected; an attempt to modify them will cause an EN_PROTECTED notification code. CFE_PROTECTED = 0x00000010, /// Characters are marked as revised. CFE_REVISED = CFM.CFM_REVISED, /// Characters are displayed as shadowed characters. The value does not affect how the control displays the text. CFE_SHADOW = CFM.CFM_SHADOW, /// Characters are in small capital letters. The value does not affect how the control displays the text. CFE_SMALLCAPS = CFM.CFM_SMALLCAPS, /// Characters are struck out. CFE_STRIKEOUT = 0x00000008, /// /// Characters are subscript. The CFE_SUPERSCRIPT and CFE_SUBSCRIPT values are mutually exclusive. For both values, the control /// automatically calculates an offset and a smaller font size. Alternatively, you can use the yHeight and yOffset members to /// explicitly specify font size and offset for subscript and superscript characters. /// CFE_SUBSCRIPT = 0x00010000, /// Characters are superscript. CFE_SUPERSCRIPT = 0x00020000, /// Characters are underlined. CFE_UNDERLINE = 0x00000004, } /// /// Specifies the parts of the CHARFORMAT2 structure that contain valid information. The dwMask member can be a combination of the values /// from two sets of bit flags. One set indicates the structure members that are valid. Another set indicates the valid attributes in the /// dwEffects member. /// [PInvokeData("richedit.h", MSDNShortId = "NS:richedit.CHARFORMAT2A")] [Flags] public enum CFM : uint { /// The bAnimation member is valid. CFM_ANIMATION = 0x00040000, /// The crBackColor member is valid. CFM_BACKCOLOR = 0x04000000, /// The bCharSet member is valid. CFM_CHARSET = 0x08000000, /// The szFaceName member is valid. CFM_FACE = 0x20000000, /// The wKerning member is valid. CFM_KERNING = 0x00100000, /// The lcid member is valid. CFM_LCID = 0x02000000, /// The yOffset member is valid. CFM_OFFSET = 0x10000000, /// The bRevAuthor member is valid. CFM_REVAUTHOR = 0x00008000, /// The yHeight member is valid. CFM_SIZE = 0x80000000, /// The sSpacing member is valid. CFM_SPACING = 0x00200000, /// The sStyle member is valid. CFM_STYLE = 0x00080000, /// The bUnderlineType member is valid. CFM_UNDERLINETYPE = 0x00800000, /// The wWeight member is valid. CFM_WEIGHT = 0x00400000, /// Windows 8: A combination of the following values: CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET CFM_ALL = CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET, /// The CFE_BOLD value of the dwEffects member is valid. CFM_BOLD = 0x00000001, /// The crTextColor member and the CFE_AUTOCOLOR value of the dwEffects member are valid. CFM_COLOR = 0x40000000, /// /// Windows 8: A combination of the following values: CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | CFM_STRIKEOUT | /// CFE_PROTECTED | CFM_LINK /// CFM_EFFECTS = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | CFM_STRIKEOUT | CFM_PROTECTED | CFM_LINK, /// The CFE_ITALIC value of the dwEffects member is valid. CFM_ITALIC = 0x00000002, /// The CFE_PROTECTED value of the dwEffects member is valid. CFM_PROTECTED = 0x00000010, /// The CFE_STRIKEOUT value of the dwEffects member is valid. CFM_STRIKEOUT = 0x00000008, /// The CFE_UNDERLINE value of the dwEffects member is valid. CFM_UNDERLINE = 0x00000004, /// /// A combination of the following values: CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID | CFM_UNDERLINETYPE | CFM_WEIGHT | /// CFM_REVAUTHOR | CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION | CFM_COOKIE /// CFM_ALL2 = CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID | CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR | CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION | CFM_COOKIE, /// The CFE_ALLCAPS value is valid. CFM_ALLCAPS = 0x00000080, /// The dwCookie value is valid. CFM_COOKIE = 0x01000000, /// The CFE_DISABLED value is valid. CFM_DISABLED = 0x00002000, /// The CFE_EXTENDED value is valid. CFM_EXTENDED = 0x02000000, /// /// A combination of the following values: CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS | CFM_HIDDEN | CFM_OUTLINE | /// CFM_SHADOW | CFM_EMBOSS | CFM_IMPRINT | CFM_REVISED | CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR /// CFM_EFFECTS2 = CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS | CFM_HIDDEN | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS | CFM_IMPRINT | CFM_REVISED | CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR, /// The CFE_EMBOSS value is valid. CFM_EMBOSS = 0x00000800, /// The CFE_FONTBOUND value is valid. CFM_FONTBOUND = 0x00100000, /// The CFE_HIDDEN value is valid. CFM_HIDDEN = 0x00000100, /// The CFE_IMPRINT value is valid. CFM_IMPRINT = 0x00001000, /// The CFE_LINK value is valid. CFM_LINK = 0x00000020, /// The CFE_LINKPROTECTED value is valid. CFM_LINKPROTECTED = 0x00800000, /// The CFE_MATH value is valid. CFM_MATH = 0x10000000, /// The CFE_MATHNOBUILDUP value is valid. CFM_MATHNOBUILDUP = 0x08000000, /// The CFE_MATHORDINARY value is valid. CFM_MATHORDINARY = 0x20000000, /// The CFE_OUTLINE value is valid. CFM_OUTLINE = 0x00000200, /// The CFE_REVISION value is valid. CFM_REVISED = 0x00004000, /// The CFE_SHADOW value is valid. CFM_SHADOW = 0x00000400, /// The CFE_SMALLCAPS value is valid. CFM_SMALLCAPS = 0x00000040, /// The CFE_SUBSCRIPT and CFE_SUPERSCRIPT values are valid. CFM_SUBSCRIPT = 0x00010000, /// The CFE_SUBSCRIPT and CFE_SUPERSCRIPT values are valid. CFM_SUPERSCRIPT = 0x00020000, } /// Specifies the underline type. To use this member, set the CFM_UNDERLINETYPE flag in the dwMask member. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._charformat2w")] public enum CFU : byte { /// No underline. This is the default. CFU_UNDERLINENONE, /// Text underlined with a single solid line. CFU_UNDERLINE, /// RichEdit 4.1 and later: Underline words only. The rich edit control displays the text with a solid underline. CFU_UNDERLINEWORD, /// Text underlined with a double line. The rich edit control displays the text with a solid underline. CFU_UNDERLINEDOUBLE, /// /// Text underlined with a dotted line. For versions earlier than Microsoft Rich Edit 3.0, text is displayed with a solid underline. /// CFU_UNDERLINEDOTTED, /// Text underlined with dashes. CFU_UNDERLINEDASH, /// Text underlined with a dashed and dotted line. CFU_UNDERLINEDASHDOT, /// Text underlined with a dashed and doubled dotted line. CFU_UNDERLINEDASHDOTDOT, /// RichEdit 4.1 and later: Text underlined with a wavy line. CFU_UNDERLINEWAVE, /// Display as CFU_UNDERLINE. CFU_UNDERLINETHICK, /// Display as CFU_UNDERLINE. CFU_UNDERLINEHAIRLINE, /// Display as CFU_UNDERLINEWAVE. CFU_UNDERLINEDOUBLEWAVE, /// Display as CFU_UNDERLINEWAVE. CFU_UNDERLINEHEAVYWAVE, /// Display as CFU_UNDERLINEDASH. CFU_UNDERLINELONGDASH, /// Display as CFU_UNDERLINEDASH. CFU_UNDERLINETHICKDASH, /// Display as CFU_UNDERLINEDASHDOT. CFU_UNDERLINETHICKDASHDOT, /// Display as CFU_UNDERLINEDASHDOT. CFU_UNDERLINETHICKDASHDOTDOT, /// Display as CFU_UNDERLINEDOT. CFU_UNDERLINETHICKDOTTED, /// Display as CFU_UNDERLINEDASH. CFU_UNDERLINETHICKLONGDASH, /// For IME composition, fake a selection. CFU_INVERT = 0xFE, /// /// The structure maps CHARFORMAT's bit underline to CHARFORMAT2, (that is, it performs a CHARFORMAT type of underline on this text). /// CFU_CF1UNDERLINE = 0xFF, } /// IME mode bias value. [PInvokeData("richedit.h")] public enum CTFMODEBIAS { /// There is no mode bias. CTFMODEBIAS_DEFAULT = 0x0000, /// The bias is to a filename. CTFMODEBIAS_FILENAME = 0x0001, /// The bias is to a name. CTFMODEBIAS_NAME = 0x0002, /// The bias is to the reading. CTFMODEBIAS_READING = 0x0003, /// The bias is to a date or time. CTFMODEBIAS_DATETIME = 0x0004, /// The bias is to a conversation. CTFMODEBIAS_CONVERSATION = 0x0005, /// The bias is to a number. CTFMODEBIAS_NUMERIC = 0x0006, /// The bias is to hiragana strings. CTFMODEBIAS_HIRAGANA = 0x0007, /// The bias is to katakana strings. CTFMODEBIAS_KATAKANA = 0x0008, /// The bias is to Hangul characters. CTFMODEBIAS_HANGUL = 0x0009, /// The bias is to half-width katakana strings. CTFMODEBIAS_HALFWIDTHKATAKANA = 0x000A, /// The bias is to full-width alphanumeric characters. CTFMODEBIAS_FULLWIDTHALPHANUMERIC = 0x000B, /// The bias is to half-width alphanumeric characters. CTFMODEBIAS_HALFWIDTHALPHANUMERIC = 0x000C, } /// Indicates the state of the composition. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._endcomposition")] public enum ECN : uint { /// The composition is complete. ECN_ENDCOMPOSITION = 1, /// There are new characters in the composition. ECN_NEWTEXT = 2, } /// Specifies the edit control options. [PInvokeData("richedit.h")] [Flags] public enum ECO : uint { /// Automatic selection of word on double-click. ECO_AUTOWORDSELECTION = 0x00000001, /// Same as ES_AUTOVSCROLL style. ECO_AUTOVSCROLL = 0x00000040, /// Same as ES_AUTOHSCROLL style. ECO_AUTOHSCROLL = 0x00000080, /// Same as ES_NOHIDESEL style. ECO_NOHIDESEL = 0x00000100, /// Same as ES_READONLY style. ECO_READONLY = 0x00000800, /// Same as ES_WANTRETURN style. ECO_WANTRETURN = 0x00001000, /// Same as ES_SAVESEL style. ECO_SAVESEL = 0x00008000, /// Same as ES_SELECTIONBAR style. ECO_SELECTIONBAR = 0x01000000, /// Same as ES_VERTICAL style. Available in Asian-language versions only. ECO_VERTICAL = 0x00400000, } /// Specifies the operation to perform on edit control options. [PInvokeData("richedit.h")] [Flags] public enum ECOOP : ushort { /// Sets the options to those specified by lParam. ECOOP_SET = 0x0001, /// Combines the specified options with the current options. ECOOP_OR = 0x0002, /// Retains only those current options that are also specified by lParam. ECOOP_AND = 0x0003, /// Logically exclusive OR the current options with those specified by lParam. ECOOP_XOR = 0x0004, } /// The current ellipsis mode. [PInvokeData("richedit.h")] public enum ELLIPSIS { /// No ellipsis is used. ELLIPSIS_NONE = 0x00000000, /// Ellipsis at the end (forced break) ELLIPSIS_END = 0x00000001, /// Ellipsis at the end (word break) ELLIPSIS_WORD = 0x00000003, } /// The event mask specifies which notification codes a rich edit control sends to its parent window. [PInvokeData("richedit.h")] [Flags] public enum ENM : uint { /// Sends EN_NONE notifications. ENM_NONE = 0x00000000, /// Sends EN_CHANGE notifications. ENM_CHANGE = 0x00000001, /// /// Sends EN_UPDATE notifications. Rich Edit 2.0 and later: this flag is ignored and the EN_UPDATE notifications are always sent. /// However, if Rich Edit 3.0 emulates Microsoft Rich Edit 1.0, you must use this flag to send EN_UPDATE notifications. /// ENM_UPDATE = 0x00000002, /// Sends EN_HSCROLL and EN_VSCROLL notifications. ENM_SCROLL = 0x00000004, /// Sends EN_MSGFILTER notifications for mouse wheel events. ENM_SCROLLEVENTS = 0x00000008, /// Sends EN_DRAGDROPDONE notifications. ENM_DRAGDROPDONE = 0x00000010, /// Sends EN_PARAGRAPHEXPANDED notifications. ENM_PARAGRAPHEXPANDED = 0x00000020, /// Sends EN_PAGECHANGE notifications. ENM_PAGECHANGE = 0x00000040, /// Sends EN_CLIPFORMAT notifications. ENM_CLIPFORMAT = 0x00000080, /// Sends EN_MSGFILTER notifications for keyboard events. ENM_KEYEVENTS = 0x00010000, /// Sends EN_MSGFILTER notifications for mouse events. ENM_MOUSEEVENTS = 0x00020000, /// Sends EN_REQUESTRESIZE notifications. ENM_REQUESTRESIZE = 0x00040000, /// Sends EN_SELCHANGE notifications. ENM_SELCHANGE = 0x00080000, /// Sends EN_DROPFILES notifications. ENM_DROPFILES = 0x00100000, /// Sends EN_PROTECTED notifications. ENM_PROTECTED = 0x00200000, /// Sends EN_CORRECTTEXT notifications. ENM_CORRECTTEXT = 0x00400000, /// /// Microsoft Rich Edit 1.0 only: Sends EN_IMECHANGE notifications when the IME conversion status has changed. Only for /// Asian-language versions of the operating system. /// ENM_IMECHANGE = 0x00800000, /// Sends EN_LANGCHANGE notifications. ENM_LANGCHANGE = 0x01000000, /// Sends EN_OBJECTPOSITIONS notifications. ENM_OBJECTPOSITIONS = 0x02000000, /// /// Rich Edit 2.0 and later: Sends EN_LINK notifications when the mouse pointer is over text that has the CFE_LINK and one of several /// mouse actions is performed. /// ENM_LINK = 0x04000000, /// Sends EN_LOWFIRTF notifications. ENM_LOWFIRTF = 0x08000000, /// Sends EN_STARTCOMPOSITION notifications. ENM_STARTCOMPOSITION = 0x10000000, /// Sends EN_ENDCOMPOSITION notifications. ENM_ENDCOMPOSITION = 0x20000000, /// Sends EN_GROUPTYPINGCHANGE notifications. ENM_GROUPTYPINGCHANGE = 0x40000000, /// Sends EN_HIDELINKTOOLTIP notifications. ENM_HIDELINKTOOLTIP = 0x80000000, } /// EM_GETPAGEROTATE wParam values for text layout. [PInvokeData("richedit.h")] public enum EPR { /// Text flows left to right and top to bottom EPR_0 = 0, /// Text flows top to bottom and right to left EPR_270 = 1, /// Text flows right to left and bottom to top EPR_180 = 2, /// Text flows bottom to top and left to right EPR_90 = 3, /// Text flows top to bottom and left to right (Mongolian text layout) EPR_SE = 5, } /// Flags for GETCONTEXTMENUEX. [Flags] public enum GCMF : uint { /// Get the context menu that is invoked by tapping a touch gripper handle. GCMF_GRIPPER = 0x00000001, /// Get the context menu for a spelling error. GCMF_SPELLING = 0x00000002, /// Get the context menu that is invoked by mouse. GCMF_MOUSEMENU = 0x00000004, /// Get the context menu that is invoked by touch. GCMF_TOUCHMENU = 0x00000008, } /// Value specifying a text operation. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._gettextex")] [Flags] public enum GT : uint { /// /// All text is retrieved according to the following criteria: /// /// /// Carriage returns (U+000D) are not translated into CRLF (U+000D U+000A). /// /// /// Table and math-object structure characters are removed(see GT_RAWTEXT). /// /// /// Hidden text is included. /// /// /// List numbers are not included. /// /// /// GT_DEFAULT = 0, /// When copying text, translate each CR into a CR/LF. GT_USECRLF = 1, /// Retrieve the text for the current selection. GT_SELECTION = 2, /// /// Text is retrieved exactly as it appears in memory. This includes special structure characters for table row and cell delimiters /// (see Remarks for EM_INSERTTABLE) as well as math object delimiters (start delimiter U+FDD0, argument delimiter U+FDEE, and end /// delimiter U+FDDF) and object markers (U+FFFC). This maintains character-position alignment between the retrieved text and the /// text in memory. /// GT_RAWTEXT = 4, /// Hidden text is not included in the retrieved text. GT_NOHIDDENTEXT = 8, } /// Value specifying the method to be used in determining the text length. [Flags] public enum GTL : uint { /// Returns the number of characters. This is the default. GTL_DEFAULT = 0, /// Computes the answer by using CR/LFs at the end of paragraphs. GTL_USECRLF = 1, /// /// Computes a precise answer. This approach could necessitate a conversion and thereby take longer. This flag cannot be used with /// the GTL_CLOSE flag. E_INVALIDARG will be returned if both are used. /// GTL_PRECISE = 2, /// /// Computes an approximate (close) answer. It is obtained quickly and can be used to set the buffer size. This flag cannot be used /// with the GTL_PRECISE flag. E_INVALIDARG will be returned if both are used. /// GTL_CLOSE = 4, /// /// Returns the number of characters. This flag cannot be used with the GTL_NUMBYTES flag. E_INVALIDARG will be returned if both are used. /// GTL_NUMCHARS = 8, /// /// Returns the number of bytes. This flag cannot be used with the GTL_NUMCHARS flag. E_INVALIDARG will be returned if both are used. /// GTL_NUMBYTES = 16, } /// The Input Method Editor (IME) mode for a rich edit control. [PInvokeData("richedit.h")] public enum ICM { /// IME is not open. ICM_NOTOPEN = 0x0000, /// True inline mode. ICM_LEVEL3 = 0x0001, /// Level 2. ICM_LEVEL2 = 0x0002, /// Level 2.5 ICM_LEVEL2_5 = 0x0003, /// Special UI. ICM_LEVEL2_SUI = 0x0004, /// ICM_CTF = 0x0005, } /// Type of composition string. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._imecomptext")] [Flags] public enum ICT : uint { /// The final composed string. ICT_RESULTREADSTR = 0x0001, } /// The Input Method Editor (IME) options. [PInvokeData("richedit.h")] [Flags] public enum IMF : uint { /// Disables IME handling. IMF_FORCENONE = 0x0001, /// Enables the IME when the control receives the input focus. IMF_FORCEENABLE = 0x0002, /// Disables the IME when the control receives the input focus. IMF_FORCEDISABLE = 0x0004, /// Closes the IME status window when the control receives the input focus. IMF_CLOSESTATUSWINDOW = 0x0008, /// Note used in Rich Edit 2.0 and later. IMF_VERTICAL = 0x0020, /// Activates the IME when the control receives the input focus. IMF_FORCEACTIVE = 0x0040, /// Inactivates the IME when the control receives the input focus. IMF_FORCEINACTIVE = 0x0080, /// Restores the previous IME status when the control receives the input focus. IMF_FORCEREMEMBER = 0x0100, /// /// Specifies that the composition string will not be canceled or determined by focus changes. This allows an application to have /// separate composition strings on each rich edit control. /// IMF_MULTIPLEEDIT = 0x0400, } /// IME mode bias value. [PInvokeData("richedit.h")] [Flags] public enum IMF_SMODE : uint { /// Sets the IME mode bias to Name. IMF_SMODE_PLAURALCLAUSE = 0x0001, /// No bias. IMF_SMODE_NONE = 0x0002, } /// /// Contains values used to specify how to do hyphenation in a rich edit control. The HyphenateProc callback function uses this /// enumeration type. /// /// Hyphenation rules are specific for each language; not all hyphenation types are valid for a given language. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ne-richedit-khyph typedef enum tagKHYPH { khyphNil, khyphNormal, // khyphAddBefore, khyphChangeBefore, khyphDeleteBefore, khyphChangeAfter, khyphDelAndChange } KHYPH; [PInvokeData("richedit.h", MSDNShortId = "NE:richedit.tagKHYPH")] public enum KHYPH { /// No hyphenation is allowed. khyphNil, /// Do not change any characters during hyphenation. khyphNormal, /// Add a letter before the hyphenation mark. khyphAddBefore, /// Change the letter before the hyphenation mark. khyphChangeBefore, /// Delete the letter before the hyphenation mark. khyphDeleteBefore, /// Change the letter after the hyphenation mark. khyphChangeAfter, /// /// The two letters before the hyphenation mark are replaced by one character; see the /// chHyph /// member of /// HYPHRESULT /// . /// khyphDelAndChange, } /// Operation that failed. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._enoleopfailed")] public enum OLEOP { /// Indicates that IOleObject::DoVerb failed. OLEOP_DOVERB = 1 } /// Paragraph alignment. To use this member, set the PFM_ALIGNMENT flag in the dwMask member. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._paraformat")] [Flags] public enum PFA : ushort { /// Paragraphs are aligned with the left margin. PFA_LEFT = 1, /// Paragraphs are aligned with the right margin. PFA_RIGHT = 2, /// Paragraphs are centered. PFA_CENTER = 3, /// /// RichEdit 2.0:Paragraphs are justified. Rich edit controls earlier than RichEdit 3.0 display the text aligned with the left margin. /// PFA_JUSTIFY = 4, /// Paragraphs are justified by expanding the blanks alone. PFA_FULL_INTERWORD = 4, } /// /// A set of bit flags that specify paragraph effects. These flags are included only for compatibility with TOM interfaces; the rich edit /// control stores the value but does not use it to display the text. /// [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._paraformat")] [Flags] public enum PFE : ushort { /// Displays text using right-to-left reading order. PFE_RTLPARA = (ushort)(PFM.PFM_RTLPARA >> 16), /// No page break within the paragraph. PFE_KEEP = (ushort)(PFM.PFM_KEEP >> 16), /// No page break between this paragraph and the next. PFE_KEEPNEXT = (ushort)(PFM.PFM_KEEPNEXT >> 16), /// Inserts a page break before the selected paragraph. PFE_PAGEBREAKBEFORE = (ushort)(PFM.PFM_PAGEBREAKBEFORE >> 16), /// Disables line numbering (not implemented). PFE_NOLINENUMBER = (ushort)(PFM.PFM_NOLINENUMBER >> 16), /// Disables widow and orphan control for the selected paragraph. PFE_NOWIDOWCONTROL = (ushort)(PFM.PFM_NOWIDOWCONTROL >> 16), /// Disables automatic hyphenation. PFE_DONOTHYPHEN = (ushort)(PFM.PFM_DONOTHYPHEN >> 16), /// Displays paragraphs side by side (not implemented). PFE_SIDEBYSIDE = (ushort)(PFM.PFM_SIDEBYSIDE >> 16), /// PFE_TEXTWRAPPINGBREAK = (ushort)(PFM.PFM_TEXTWRAPPINGBREAK >> 16), /// PFE_COLLAPSED = (ushort)(PFM.PFM_COLLAPSED >> 16), /// PFE_BOX = (ushort)(PFM.PFM_BOX >> 16), /// The paragraph is a table row. PFE_TABLE = (ushort)(PFM.PFM_TABLE >> 16), /// The paragraph is a start delimiter (U+FFF9 U+000D) or end delimiter (U+FFFB U+000D) of a row in a table. PFE_TABLEROWDELIMITER = (ushort)(PFM.PFM_TABLEROWDELIMITER >> 16), } /// /// Members containing valid information or attributes to set. This parameter can be none or a combination of the following values. If /// both PFM_STARTINDENT and PFM_OFFSETINDENT are specified, PFM_STARTINDENT takes precedence. /// [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._paraformat")] [Flags] public enum PFM : uint { /// /// The dxStartIndent member is valid and specifies the indentation from the left margin. If both PFM_STARTINDENT and /// PFM_OFFSETINDENT are specified, PFM_STARTINDENT takes precedence. /// PFM_STARTINDENT = 0x00000001, /// The dxRightIndent member is valid. PFM_RIGHTINDENT = 0x00000002, /// The dxOffset member is valid. PFM_OFFSET = 0x00000004, /// The wAlignment member is valid. PFM_ALIGNMENT = 0x00000008, /// The cTabStobs and rgxTabStops members are valid. PFM_TABSTOPS = 0x00000010, /// The wNumbering member is valid. PFM_NUMBERING = 0x00000020, /// /// The dxStartIndent member is valid. If you are setting the indentation, dxStartIndent specifies the amount to indent relative to /// the current indentation. /// PFM_OFFSETINDENT = 0x80000000, /// The dySpaceBefore member is valid. PFM_SPACEBEFORE = 0x00000040, /// The dySpaceAfter member is valid. PFM_SPACEAFTER = 0x00000080, /// The dyLineSpacing and bLineSpacingRule members are valid. PFM_LINESPACING = 0x00000100, /// The sStyle member is valid. PFM_STYLE = 0x00000400, /// The wBorderSpace, wBorderWidth, and wBorders members are valid. PFM_BORDER = 0x00000800, /// The wShadingWeight and wShadingStyle members are valid. PFM_SHADING = 0x00001000, /// The wNumberingStyle member is valid. PFM_NUMBERINGSTYLE = 0x00002000, /// The wNumberingTab member is valid. PFM_NUMBERINGTAB = 0x00004000, /// The wNumberingStart member is valid. PFM_NUMBERINGSTART = 0x00008000, /// Rich Edit 2.0: The wEffects member is valid PFM_RTLPARA = 0x00010000, /// The PFE_KEEP value is valid. PFM_KEEP = 0x00020000, /// The PFE_KEEPNEXT value is valid. PFM_KEEPNEXT = 0x00040000, /// The PFE_PAGEBREAKBEFORE value is valid. PFM_PAGEBREAKBEFORE = 0x00080000, /// The PFE_NOLINENUMBER value is valid. PFM_NOLINENUMBER = 0x00100000, /// The PFE_NOWIDOWCONTROL value is valid. PFM_NOWIDOWCONTROL = 0x00200000, /// The PFE_DONOTHYPHEN value is valid. PFM_DONOTHYPHEN = 0x00400000, /// The PFE_SIDEBYSIDE value is valid. PFM_SIDEBYSIDE = 0x00800000, /// PFM_COLLAPSED = 0x01000000, /// The bOutlineLevel member is valid. PFM_OUTLINELEVEL = 0x02000000, /// PFM_BOX = 0x04000000, /// PFM_RESERVED2 = 0x08000000, /// The PFE_TABLEROWDELIMITER value is valid. PFM_TABLEROWDELIMITER = 0x10000000, /// PFM_TEXTWRAPPINGBREAK = 0x20000000, /// The PFE_TABLE value is valid. PFM_TABLE = 0x40000000, /// /// A combination of the following values: PFM_STARTINDENT, PFM_RIGHTINDENT, PFM_OFFSET, PFM_ALIGNMENT, PFM_TABSTOPS, PFM_NUMBERING, /// PFM_OFFSETINDENT, and PFM_RTLPARA. /// PFM_ALL = PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET | PFM_ALIGNMENT | PFM_TABSTOPS | PFM_NUMBERING | PFM_OFFSETINDENT | PFM_RTLPARA, /// The PFM effects PFM_EFFECTS = PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE | PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER | PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE | PFM_TABLE | PFM_TABLEROWDELIMITER, /// /// A combination of the following values: PFM_ALL, PFM_EFFECTS, PFM_SPACEBEFORE, PFM_SPACEAFTER, PFM_LINESPACING, PFM_STYLE, /// PFM_SHADING, PFM_BORDER, PFM_NUMBERINGTAB, PFM_NUMBERINGSTART, and PFM_NUMBERINGSTYLE. /// PFM_ALL2 = PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER | PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER | PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE, } /// Options used for bulleted or numbered paragraphs. To use this member, set the PFM_NUMBERING flag in the dwMask member. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._paraformat")] [Flags] public enum PFN : ushort { /// No paragraph numbering or bullets. PFN_NONE = 0, /// Insert a bullet at the beginning of each selected paragraph. PFN_BULLET = 1, /// Use Arabic numbers (0, 1, 2, and so on). PFN_ARABIC = 2, /// Use lowercase letters (a, b, c, and so on). PFN_LCLETTER = 3, /// Use uppercase letters (A, B, C, and so on). PFN_UCLETTER = 4, /// Use lowercase Roman letters (i, ii, iii, and so on). PFN_LCROMAN = 5, /// Use uppercase Roman letters (I, II, III, and so on). PFN_UCROMAN = 6, /// Uses a sequence of characters beginning with the Unicode character specified by the wNumberingStart member. PFN_USERDEFINED = 7, } /// Numbering style used with numbered paragraphs. Use this member in conjunction with the wNumbering member. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit.PARAFORMAT2")] public enum PFNS : ushort { /// Follows the number with a right parenthesis. PFNS_PAREN = 0x000, /// Encloses the number in parentheses. PFNS_PARENS = 0x100, /// Follows the number with a period. PFNS_PERIOD = 0x200, /// Displays only the number. PFNS_PLAIN = 0x300, /// Continues a numbered list without applying the next number or bullet. PFNS_NONUMBER = 0x400, /// Starts a new number with wNumberingStart. PFNS_NEWNUMBER = 0x8000, } /// Specifies the punctuation type [PInvokeData("richedit.h")] public enum PUNC { /// Leading punctuation characters. PC_LEADING = 2, /// Following punctuation characters. PC_FOLLOWING = 1, /// Delimiter. PC_DELIMITER = 4, /// Not supported. PC_OVERFLOW = 3, } /// Messages specific to the rich edit control. // https://learn.microsoft.com/en-us/windows/win32/controls/bumper-rich-edit-control-reference-messages [PInvokeData("richedit.h")] public enum RichEditMessage { /// /// Determines whether a rich edit control can paste a specified clipboard format. /// Parameters /// wParam /// Specifies the Clipboard Formats to try. To try any format currently on the clipboard, set this parameter to zero. /// lParam /// This parameter is not used; it must be zero. /// Returns /// If the clipboard format can be pasted, the return value is a nonzero value. /// If the clipboard format cannot be pasted, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-canpaste [MsgParams(typeof(CLIPFORMAT), null, LResultType = typeof(CLIPFORMAT))] EM_CANPASTE = WindowMessage.WM_USER + 50, /// /// Displays a portion of the contents of a rich edit control, as previously formatted for a device using the EM_FORMATRANGE message. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// A RECT structure specifying the display area of the device. /// Returns /// If the operation succeeds, the return value is TRUE. /// If the operation fails, the return value is FALSE. /// /// /// /// Text and Component Object Model (COM) objects are clipped by the rectangle. The application does not need to set the clipping region. /// /// /// Banding is the process by which a single page of output is generated using one or more separate rectangles, or bands. When all /// bands are placed on the page, a complete image results. This approach is often used by raster printers that do not have /// sufficient memory or ability to image a full page at one time. Banding devices include most dot matrix printers as well as some /// laser printers. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-displayband [MsgParams(null, typeof(RECT?), LResultType = typeof(BOOL))] EM_DISPLAYBAND = WindowMessage.WM_USER + 51, /// /// Retrieves the starting and ending character positions of the selection in a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// A CHARRANGE structure that receives the selection range. /// Returns /// This message does not return a value. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-exgetsel [MsgParams(null, typeof(CHARRANGE?), LResultType = null)] EM_EXGETSEL = WindowMessage.WM_USER + 52, /// /// Sets an upper limit to the amount of text the user can type or paste into a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Specifies the maximum amount of text that can be entered. If this parameter is zero, the default maximum is used, which is 64K /// characters. A COM object counts as a single character. /// /// Returns /// This message does not return a value. /// /// /// /// The text limit set by the EM_EXLIMITTEXT message does not limit the amount of text that you can stream into a rich edit /// control using the EM_STREAMIN message with lParam set to SF_TEXT. However, it does limit the amount of text that you can /// stream into a rich edit control using the EM_STREAMIN message with lParam set to SF_RTF. /// /// Before EM_EXLIMITTEXT is called, the default limit to the amount of text a user can enter is 32,767 characters. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-exlimittext [MsgParams(null, typeof(uint), LResultType = null)] EM_EXLIMITTEXT = WindowMessage.WM_USER + 53, /// /// Determines which line contains the specified character in a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// Zero-based index of the character. /// Returns /// This message returns the zero-based index of the line. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-exlinefromchar [MsgParams(null, typeof(uint), LResultType = typeof(uint))] EM_EXLINEFROMCHAR = WindowMessage.WM_USER + 54, /// /// Selects a range of characters or Component Object Model (COM) objects in a Microsoft Rich Edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// A CHARRANGE structure that specifies the selection range. /// Returns /// The return value is the selection that is actually set. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-exsetsel [MsgParams(null, typeof(CHARRANGE?), LResultType = typeof(CHARRANGE?))] EM_EXSETSEL = WindowMessage.WM_USER + 55, /// /// Finds text within a rich edit control. /// Parameters /// wParam /// Specify the parameters of the search operation. This parameter can be one or more of the following values. /// /// /// Value /// Meaning /// /// /// FR_DOWN /// /// Microsoft Rich Edit 2.0 and later: If set, the search is from the end of the current selection to the end of the document. If not /// set, the search is from the end of the current selection to the beginning of the document. Microsoft Rich Edit 1.0: The FR_DOWN /// flag is ignored. The search is always from the end of the current selection to the end of the document. /// /// /// /// FR_MATCHALEFHAMZA /// /// Microsoft Rich Edit 3.0 and later: If set, the search differentiates between Arabic alefs with different accents. If not set, all /// alefs are matched by the alef character alone. /// /// /// /// FR_MATCHDIAC /// /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic and Hebrew diacritical marks. If not set, /// diacritical marks are ignored. /// /// /// /// FR_MATCHKASHIDA /// /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic kashidas. If not set, kashidas are ignored. /// /// /// /// FR_MATCHWIDTH /// Windows 8: If set, single-byte and double-byte versions of the same character are considered to be not equal. /// /// /// FR_WHOLEWORD /// /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for /// word fragments that match the search string. /// /// /// /// lParam /// A FINDTEXT structure containing information about the find operation. /// Returns /// /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is /// not found, the return value is -1. /// /// /// /// The cpMin member of FINDTEXT.chrg always specifies the starting-point of the search, and cpMax specifies the /// end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a value /// of -1 in cpMax extends the search range to the end of the text. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtext [MsgParams(typeof(FR), typeof(FINDTEXT), LResultType = typeof(int))] EM_FINDTEXT = WindowMessage.WM_USER + 56, /// /// Formats a range of text in a rich edit control for a specific device. /// Parameters /// wParam /// /// Specifies whether to render the text. If this parameter is not zero, the text is rendered. Otherwise, the text is just measured. /// /// lParam /// /// A FORMATRANGE structure containing information about the output device, or NULL to free information cached by the control. /// /// Returns /// This message returns the index of the last character that fits in the region, plus 1. /// /// /// This message is typically used to format the content of rich edit control for an output device such as a printer. /// /// After using this message to format a range of text, it is important that you free cached information by sending /// EM_FORMATRANGE again, but with lParam set to NULL; otherwise, a memory leak will occur. Also, after using this /// message for one device, you must free cached information before using it again for a different device. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-formatrange [MsgParams(typeof(BOOL), typeof(FORMATRANGE?), LResultType = typeof(int))] EM_FORMATRANGE = WindowMessage.WM_USER + 57, /// /// Determines the character formatting in a rich edit control. /// Parameters /// wParam /// Specifies the range of text from which to retrieve formatting. It can be one of the following values. /// /// /// Value /// Meaning /// /// /// SCF_DEFAULT /// The default character formatting. /// /// /// SCF_SELECTION /// The current selection's character formatting. /// /// /// lParam /// /// A CHARFORMAT structure that receives the attributes of the first character. The dwMask member specifies which /// attributes are consistent throughout the entire selection. For example, if the entire selection is either in italics or not in /// italics, CFM_ITALIC is set; if the selection is partly in italics and partly not, CFM_ITALIC is not set. /// /// /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a CHARFORMAT2 structure, which is an extension of /// the CHARFORMAT structure. Before sending the EM_GETCHARFORMAT message, set the structure's cbSize member to /// indicate the version of the structure. /// /// Returns /// This message returns the value of the dwMask member of the CHARFORMAT structure. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getcharformat [MsgParams(typeof(SCF), typeof(CHARFORMAT?), LResultType = typeof(CFM))] EM_GETCHARFORMAT = WindowMessage.WM_USER + 58, /// /// Retrieves the event mask for a rich edit control. The event mask specifies which notification codes the control sends to its /// parent window. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// This message returns the event mask for the rich edit control. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-geteventmask [MsgParams(LResultType = typeof(ENM))] EM_GETEVENTMASK = WindowMessage.WM_USER + 59, /// /// Retrieves an IRichEditOle object that a client can use to access a rich edit control's Component Object Model (COM) functionality. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a pointer that receives the IRichEditOle object. The control calls the AddRef method for the object /// before returning, so the calling application must call the Release method when it is done with the object. /// /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getoleinterface [MsgParams(null, typeof(IntPtr?))] EM_GETOLEINTERFACE = WindowMessage.WM_USER + 60, /// /// Retrieves the paragraph formatting of the current selection in a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// Pointer to a PARAFORMAT structure that receives the paragraph formatting attributes of the current selection. /// /// If more than one paragraph is selected, the structure receives the attributes of the first paragraph, and the dwMask /// member specifies which attributes are consistent throughout the entire selection. /// /// /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a PARAFORMAT2 structure, which is an extension of /// the PARAFORMAT structure. Before sending the EM_GETPARAFORMAT message, set the structure's cbSize member to /// indicate the version of the structure. /// /// Returns /// This message returns the value of the dwMask member of the PARAFORMAT structure. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getparaformat [MsgParams(null, typeof(PARAFORMAT2?), LResultType = typeof(PFM))] EM_GETPARAFORMAT = WindowMessage.WM_USER + 61, /// /// Retrieves the currently selected text in a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a buffer that receives the selected text. The calling application must ensure that the buffer is large enough to hold /// the selected text. /// /// Returns /// This message returns the number of characters copied, not including the terminating null character. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getseltext [MsgParams(null, typeof(IntPtr), LResultType = typeof(uint))] EM_GETSELTEXT = WindowMessage.WM_USER + 62, /// /// The EM_HIDESELECTION message hides or shows the selection in a rich edit control. /// Parameters /// wParam /// /// Value specifying whether to hide or show the selection. If this parameter is zero, the selection is shown. Otherwise, the /// selection is hidden. /// /// lParam /// This parameter is not used; it must be zero. /// Returns /// This message does not return a value. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-hideselection [MsgParams(typeof(BOOL), null, LResultType = null)] EM_HIDESELECTION = WindowMessage.WM_USER + 63, /// /// Pastes a specific clipboard format in a rich edit control. /// Parameters /// wParam /// Specifies the Clipboard Formats. /// lParam /// /// Pointer to a REPASTESPECIAL structure or NULL. If an object is being pasted, the REPASTESPECIAL structure is /// filled in with the desired display aspect. If lParam is NULL or the dwAspect member is zero, the display aspect /// used will be the contents of the object descriptor. /// /// Returns /// This message does not return a value. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-pastespecial [MsgParams(typeof(ushort), typeof(REPASTESPECIAL?), LResultType = null)] EM_PASTESPECIAL = WindowMessage.WM_USER + 64, /// /// Forces a rich edit control to send an EN_REQUESTRESIZE notification code to its parent window. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// This message does not return a value. /// /// This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control. // https://learn.microsoft.com/en-us/windows/win32/controls/em-requestresize [MsgParams(LResultType = null)] EM_REQUESTRESIZE = WindowMessage.WM_USER + 65, /// /// Determines the selection type for a rich edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// If the selection is empty, the return value is SEL_EMPTY. /// If the selection is not empty, the return value is a set of flags containing one or more of the following values. /// /// /// Return code /// Description /// /// /// SEL_TEXT /// Text. /// /// /// SEL_OBJECT /// At least one COM object. /// /// /// SEL_MULTICHAR /// More than one character of text. /// /// /// SEL_MULTIOBJECT /// More than one COM object. /// /// /// /// This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control. // https://learn.microsoft.com/en-us/windows/win32/controls/em-selectiontype [MsgParams(LResultType = typeof(SEL))] EM_SELECTIONTYPE = WindowMessage.WM_USER + 66, /// /// The EM_SETBKGNDCOLOR message sets the background color for a rich edit control. /// Parameters /// wParam /// /// Specifies whether to use the system color. If this parameter is a nonzero value, the background is set to the window background /// system color. Otherwise, the background is set to the specified color. /// /// lParam /// A COLORREF structure specifying the color if wParam is zero. To generate a COLORREF, use the RGB macro. /// Returns /// This message returns the original background color. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setbkgndcolor [MsgParams(typeof(BOOL), typeof(COLORREF), LResultType = typeof(COLORREF))] EM_SETBKGNDCOLOR = WindowMessage.WM_USER + 67, /// /// Sets character formatting in a rich edit control. /// Parameters /// wParam /// /// Character formatting that applies to the control. If this parameter is zero, the default character format is set. Otherwise, it /// can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// SCF_ALL /// Applies the formatting to all text in the control. Not valid with SCF_SELECTION or SCF_WORD. /// /// /// SCF_ASSOCIATEFONT /// /// RichEdit 4.1: Associates a font to a given script, thus changing the default font for that script. To specify the font, /// use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. /// /// /// /// SCF_ASSOCIATEFONT2 /// /// RichEdit 4.1: Associates a surrogate (plane-2) font to a given script, thus changing the default font for that script. To /// specify the font, use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, /// szFaceName, and lcid. /// /// /// /// SCF_CHARREPFROMLCID /// Gets the character repertoire from the LCID. /// /// /// SCF_DEFAULT /// RichEdit 4.1: Sets the default font for the control. /// /// /// SPF_DONTSETDEFAULT /// Prevents setting the default paragraph format when the rich edit control is empty. /// /// /// SCF_NOKBUPDATE /// /// RichEdit 4.1: Prevents keyboard switching to match the font. For example, if an Arabic font is set, normally the automatic /// keyboard feature for Bidi languages changes the keyboard to an Arabic keyboard. /// /// /// /// SCF_SELECTION /// /// Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion /// point, and the new character format is in effect only until the insertion point changes. /// /// /// /// SPF_SETDEFAULT /// Sets the default paragraph formatting attributes. /// /// /// SCF_SMARTFONT /// Apply the font only if it can handle script. /// /// /// SCF_USEUIRULES /// /// RichEdit 4.1: Used with SCF_SELECTION. Indicates that format came from a toolbar or other UI tool, so UI formatting /// rules should be used instead of literal formatting. /// /// /// /// SCF_WORD /// /// Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the /// formatting is applied to the word. The SCF_WORD value must be used in conjunction with the SCF_SELECTION value. /// /// /// /// lParam /// /// Pointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by /// the dwMask member are changed. /// /// /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a CHARFORMAT2 structure, which is an extension of /// the CHARFORMAT structure. Before sending the EM_SETCHARFORMAT message, set the structure's cbSize member to /// or indicate which version of the structure is being used. /// /// /// The szFaceName and bCharSet members may be overruled when invalid for characters, for example: Arial on kanji characters. /// /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// /// /// If this message is sent more than once with the same parameters, the effect on the text is toggled. That is, sending the message /// once produces the effect, sending the message twice cancels the effect, and so forth. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setcharformat [MsgParams(typeof(SCF), typeof(CHARFORMAT2?))] EM_SETCHARFORMAT = WindowMessage.WM_USER + 68, /// /// Sets the event mask for a rich edit control. The event mask specifies which notification codes the control sends to its parent window. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// New event mask for the rich edit control. For a list of event masks, see Rich Edit Control Event Mask Flags. /// Returns /// This message returns the previous event mask. /// /// The default event mask (before any is set) is ENM_NONE. // https://learn.microsoft.com/en-us/windows/win32/controls/em-seteventmask [MsgParams(null, typeof(ENM), LResultType = typeof(ENM))] EM_SETEVENTMASK = WindowMessage.WM_USER + 69, /// /// Gives a rich edit control an IRichEditOleCallback object that the control uses to get OLE-related resources and /// information from the client. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// Pointer to an IRichEditOleCallback object. The control calls the AddRef method for the object before returning. /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setolecallback [MsgParams(null, typeof(IRichEditOleCallback))] EM_SETOLECALLBACK = WindowMessage.WM_USER + 70, /// /// Sets the paragraph formatting for the current selection in a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a PARAFORMAT structure specifying the new paragraph formatting attributes. Only the attributes specified by the /// dwMask member are changed. /// /// /// Microsoft Rich Edit 2.0 and later: This parameter can be a pointer to a PARAFORMAT2 structure, which is an extension of /// the PARAFORMAT structure. Before sending the EM_SETPARAFORMAT message, set the structure's cbSize member to /// indicate the version of the structure. /// /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setparaformat [MsgParams(null, typeof(PARAFORMAT2?))] EM_SETPARAFORMAT = WindowMessage.WM_USER + 71, /// /// Sets the target device and line width used for "what you see is what you get" (WYSIWYG) formatting in a rich edit control. /// Parameters /// wParam /// HDC for the target device. /// lParam /// Line width to use for formatting. /// Returns /// The return value is zero if the operation fails, or nonzero if it succeeds. /// /// /// The HDC for the default printer can be obtained as follows. /// If lParam is zero, no line breaks are created. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settargetdevice [MsgParams(typeof(HDC), typeof(int))] EM_SETTARGETDEVICE = WindowMessage.WM_USER + 72, /// /// Replaces the contents of a rich edit control with a stream of data provided by an application defined EditStreamCallback callback function. /// Parameters /// wParam /// Specifies the data format and replacement options. This value must be one of the following values. /// /// /// Value /// Meaning /// /// /// SF_RTF /// RTF /// /// /// SF_TEXT /// Text /// /// /// In addition, you can specify the following flags. /// /// /// Value /// Meaning /// /// /// SFF_PLAINRTF /// /// If specified, only keywords common to all languages are streamed in. Language-specific RTF keywords in the stream are ignored. If /// not specified, all keywords are streamed in. You can combine this flag with the SF_RTF flag. /// /// /// /// SFF_SELECTION /// /// If specified, the data stream replaces the contents of the current selection. If not specified, the data stream replaces the /// entire contents of the control. You can combine this flag with the SF_TEXT or SF_RTF flags. /// /// /// /// SF_UNICODE /// /// Microsoft Rich Edit 2.0 and later: Indicates Unicode text. You can combine this flag with the SF_TEXT flag. /// /// /// /// lParam /// /// Pointer to an EDITSTREAM structure. On input, the pfnCallback member of this structure must point to an application /// defined EditStreamCallback function. On output, the dwError member can contain a nonzero error code if an error occurred. /// /// Returns /// This message returns the number of characters read. /// /// /// When you send an EM_STREAMIN message, the rich edit control makes repeated calls to the EditStreamCallback function /// specified by the pfnCallback member of the EDITSTREAM structure. Each time the callback function is called, it /// fills a buffer with data to read into the control. This continues until the callback function indicates that the stream-in /// operation has been completed or an error occurs. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-streamin [MsgParams(typeof(SF), typeof(EDITSTREAM?))] EM_STREAMIN = WindowMessage.WM_USER + 73, /// /// Causes a rich edit control to pass its contents to an application defined EditStreamCallback callback function. The callback /// function can then write the stream of data to a file or any other location that it chooses. /// Parameters /// wParam /// Specifies the data format and replacement options. /// This value must be one of the following values. /// /// /// Value /// Meaning /// /// /// SF_RTF /// RTF. /// /// /// SF_RTFNOOBJS /// RTF with spaces in place of COM objects. /// /// /// SF_TEXT /// Text with spaces in place of COM objects. /// /// /// SF_TEXTIZED /// Text with a text representation of COM objects. /// /// /// /// The SF_RTFNOOBJS option is useful if an application stores COM objects itself, as RTF representation of COM objects is not /// very compact. The control word, \objattph, followed by a space denotes the object position. /// /// In addition, you can specify the following flags. /// /// /// Value /// Meaning /// /// /// SFF_PLAINRTF /// /// If specified, the rich edit control streams out only the keywords common to all languages, ignoring language-specific keywords. /// If not specified, the rich edit control streams out all keywords. You can combine this flag with the SF_RTF or /// SF_RTFNOOBJS flag. /// /// /// /// SFF_SELECTION /// /// If specified, the rich edit control streams out only the contents of the current selection. If not specified, the control streams /// out the entire contents. You can combine this flag with any of data format values. /// /// /// /// SF_UNICODE /// /// Microsoft Rich Edit 2.0 and later: Indicates Unicode text. You can combine this flag with the SF_TEXT flag. /// /// /// /// SF_USECODEPAGE /// /// Rich Edit 3.0 and later: Generates UTF-8 RTF as well as text using other code pages. The code page is set in the high word /// of wParam. For example, for UTF-8 RTF, set wParam to (CP_UTF8 << 16) | SF_USECODEPAGE | SF_RTF. /// /// /// /// lParam /// /// Pointer to an EDITSTREAM structure. On input, the pfnCallback member of this structure must point to an application /// defined EditStreamCallback function. On output, the dwError member can contain a nonzero error code if an error occurred. /// /// Returns /// This message returns the number of characters written to the data stream. /// /// /// When you send an EM_STREAMOUT message, the rich edit control makes repeated calls to the EditStreamCallback function /// specified by the pfnCallback member of the EDITSTREAM structure. Each time it calls the callback function, the /// control passes a buffer containing a portion of the contents of the control. This process continues until the control has passed /// all its contents to the callback function, or until an error occurs. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-streamout [MsgParams(typeof(SF), typeof(EDITSTREAM?))] EM_STREAMOUT = WindowMessage.WM_USER + 74, /// /// Retrieves a specified range of characters from a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a TEXTRANGE structure that specifies the range of characters to retrieve and a buffer to copy the characters to. /// /// Returns /// The message returns the number of characters copied, not including the terminating null character. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextrange [MsgParams(null, typeof(TEXTRANGE?))] EM_GETTEXTRANGE = WindowMessage.WM_USER + 75, /// /// Finds the next word break before or after the specified character position or retrieves information about the character at that position. /// Parameters /// wParam /// Specifies the find operation. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// WB_CLASSIFY /// Returns the character class and word-break flags of the character at the specified position. /// /// /// WB_ISDELIMITER /// Returns TRUE if the character at the specified position is a delimiter, or FALSE otherwise. /// /// /// WB_LEFT /// Finds the nearest character before the specified position that begins a word. /// /// /// WB_LEFTBREAK /// Finds the next word end before the specified position. This value is the same as WB_PREVBREAK. /// /// /// WB_MOVEWORDLEFT /// /// Finds the next character that begins a word before the specified position. This value is used during CTRL+LEFT ARROW key /// processing. This value is the similar to WB_MOVEWORDPREV. See Remarks for more information. /// /// /// /// WB_MOVEWORDRIGHT /// /// Finds the next character that begins a word after the specified position. This value is used during CTRL+right key processing. /// This value is similar to WB_MOVEWORDNEXT. See Remarks for more information. /// /// /// /// WB_RIGHT /// Finds the next character that begins a word after the specified position. /// /// /// WB_RIGHTBREAK /// Finds the next end-of-word delimiter after the specified position. This value is the same as WB_NEXTBREAK. /// /// /// lParam /// Zero-based character starting position. /// Returns /// The message returns a value based on the wParam parameter. /// /// /// Return code /// Description /// /// /// wParam /// Return Value /// /// /// WB_CLASSIFY /// Returns the character class and word-break flags of the character at the specified position. /// /// /// WB_ISDELIMITER /// Returns TRUE if the character at the specified position is a delimiter; otherwise it returns FALSE. /// /// /// Others /// Returns the character index of the word break. /// /// /// /// /// /// If wParam is WB_LEFT and WB_RIGHT, the word-break procedure finds word breaks only after delimiters. This matches the /// functionality of an edit control. If wParam is WB_MOVEWORDLEFT or WB_MOVEWORDRIGHT, the word-break procedure also compares /// character classes and word-break flags. /// /// For information about character classes and word-break flags, see Word and Line Breaks. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-findwordbreak [MsgParams(typeof(WB), typeof(uint))] EM_FINDWORDBREAK = WindowMessage.WM_USER + 76, /// /// Sets the options for a rich edit control. /// Parameters /// wParam /// Specifies the operation, which can be one of these values. /// /// /// Value /// Meaning /// /// /// ECOOP_SET /// Sets the options to those specified by lParam. /// /// /// ECOOP_OR /// Combines the specified options with the current options. /// /// /// ECOOP_AND /// Retains only those current options that are also specified by lParam. /// /// /// ECOOP_XOR /// Logically exclusive OR the current options with those specified by lParam. /// /// /// lParam /// Specifies one or more of the following values. /// /// /// Value /// Meaning /// /// /// ECO_AUTOWORDSELECTION /// Automatic selection of word on double-click. /// /// /// ECO_AUTOVSCROLL /// Same as ES_AUTOVSCROLL style. /// /// /// ECO_AUTOHSCROLL /// Same as ES_AUTOHSCROLL style. /// /// /// ECO_NOHIDESEL /// Same as ES_NOHIDESEL style. /// /// /// ECO_READONLY /// Same as ES_READONLY style. /// /// /// ECO_WANTRETURN /// Same as ES_WANTRETURN style. /// /// /// ECO_SELECTIONBAR /// Same as ES_SELECTIONBAR style. /// /// /// ECO_VERTICAL /// Same as ES_VERTICAL style. Available in Asian-language versions only. /// /// /// Returns /// This message returns the current options of the edit control. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setoptions [MsgParams(typeof(ECOOP), typeof(ECO), LResultType = typeof(ECO))] EM_SETOPTIONS = WindowMessage.WM_USER + 77, /// /// Retrieves rich edit control options. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// This message returns a combination of the current option flag values described in the EM_SETOPTIONS message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getoptions [MsgParams(LResultType = typeof(ECO))] EM_GETOPTIONS = WindowMessage.WM_USER + 78, /// /// Finds text within a rich edit control. /// Parameters /// wParam /// Specifies the behavior of the search operation. This parameter can be one or more of the following values. /// /// /// Value /// Meaning /// /// /// FR_DOWN /// /// Microsoft Rich Edit 2.0 and later: If set, the search is forward from FINDTEXTEX.chrg.cpMin; if not set, the search is /// backward from FINDTEXTEX.chrg.cpMin. Microsoft Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always forward. /// /// /// /// FR_MATCHALEFHAMZA /// /// Microsoft Rich Edit 3.0 and later: If set, the search differentiates between Arabic and Hebrew alefs with different accents. If /// not set, all alefs are matched by the alef character alone. /// /// /// /// FR_MATCHCASE /// If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive. /// /// /// FR_MATCHDIAC /// /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic and Hebrew diacritical marks. If not set, /// diacritical marks are ignored. /// /// /// /// FR_MATCHKASHIDA /// /// Microsoft Rich Edit 3.0 and later: If set, the search operation considers Arabic and Hebrew kashidas. If not set, kashidas are ignored. /// /// /// /// FR_WHOLEWORD /// /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for /// word fragments that match the search string. /// /// /// /// lParam /// A FINDTEXTEX structure containing information about the find operation. /// Returns /// /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is /// not found, the return value is -1. /// /// /// /// Use this message to find ANSI strings. For Unicode, use EM_FINDTEXTEXW. /// /// The cpMin member of FINDTEXTEX.chrg always specifies the starting-point of the search, and cpMax specifies /// the end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a /// value of -1 in cpMax extends the search range to the end of the text. /// /// /// If the search operation finds a match, the chrgText member of the FINDTEXTEX structure returns the range of /// character positions that contains the matching text. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtextex [MsgParams(typeof(FR), typeof(FINDTEXTEX?))] EM_FINDTEXTEX = WindowMessage.WM_USER + 79, /// /// Retrieves the address of the currently registered extended word-break procedure for a rich edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// The message returns the address of the current procedure. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getwordbreakprocex [MsgParams(LResultType = typeof(EDITWORDBREAKPROCEX))] EM_GETWORDBREAKPROCEX = WindowMessage.WM_USER + 80, /// /// Sets the extended word-break procedure for a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// Pointer to an EditWordBreakProcEx function, or NULL to use the default procedure. /// Returns /// This message returns the address of the previous extended word-break procedure. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setwordbreakprocex [MsgParams(null, typeof(EDITWORDBREAKPROCEX), LResultType = typeof(EDITWORDBREAKPROCEX))] EM_SETWORDBREAKPROCEX = WindowMessage.WM_USER + 81, /// /// Sets the maximum number of actions that can stored in the undo queue of a rich edit control. /// Parameters /// wParam /// Specifies the maximum number of actions that can be stored in the undo queue. /// lParam /// This parameter is not used; it must be zero. /// Returns /// /// The return value is the new maximum number of undo actions for the rich edit control. This value may be less than wParam if /// memory is limited. /// /// /// /// /// By default, the maximum number of actions in the undo queue is 100. If you increase this number, there must be enough available /// memory to accommodate the new number. For better performance, set the limit to the smallest possible value. /// /// Setting the limit to zero disables the Undo feature. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setundolimit [MsgParams(typeof(uint), null, LResultType = typeof(uint))] EM_SETUNDOLIMIT = WindowMessage.WM_USER + 82, /// /// Sends an EM_REDO message to a rich edit control to redo the next action in the control's redo queue. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// If the Redo operation succeeds, the return value is a nonzero value. /// If the Redo operation fails, the return value is zero. /// /// To determine whether there are any actions in the control's redo queue, send the EM_CANREDO message. // https://learn.microsoft.com/en-us/windows/win32/controls/em-redo [MsgParams()] EM_REDO = WindowMessage.WM_USER + 84, /// /// Determines whether there are any actions in the control redo queue. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// If there are actions in the control redo queue, the return value is a nonzero value. /// If the redo queue is empty, the return value is zero. /// /// To redo the most recent undo operation, send the EM_REDO message. // https://learn.microsoft.com/en-us/windows/win32/controls/em-canredo [MsgParams()] EM_CANREDO = WindowMessage.WM_USER + 85, /// /// Microsoft Rich Edit 2.0 and later: Retrieves the type of the next undo action, if any. /// Microsoft Rich Edit 1.0: This message is not supported. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// /// If there is an undo action, the value returned is an UNDONAMEID enumeration value that indicates the type of the next /// action in the control's undo queue. /// /// If there are no actions that can be undone or the type of the next undo action is unknown, the return value is zero. /// /// /// The types of actions that can be undone or redone include typing, delete, drag, drop, cut, and paste operations. This information /// can be useful for applications that provide an extended user interface for undo and redo operations, such as a drop-down list box /// of actions that can be undone. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getundoname [MsgParams(LResultType = typeof(UNDONAMEID))] EM_GETUNDONAME = WindowMessage.WM_USER + 86, /// /// Retrieves the type of the next action, if any, in the rich edit control's redo queue. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// /// If the redo queue for the control is not empty, the value returned is an UNDONAMEID enumeration value that indicates the /// type of the next action in the control's redo queue. /// /// If there are no redoable actions or the type of the next redoable action is unknown, the return value is zero. /// /// /// The types of actions that can be undone or redone include typing, delete, drag-drop, cut, and paste operations. This information /// can be useful for applications that provide an extended user interface for undo and redo operations, such as a drop-down list box /// of redoable actions. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getredoname [MsgParams(LResultType = typeof(UNDONAMEID))] EM_GETREDONAME = WindowMessage.WM_USER + 87, /// /// Stops a rich edit control from collecting additional typing actions into the current undo action. The control stores the next /// typing action, if any, into a new action in the undo queue. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// The return value is zero. This message cannot fail. /// /// /// /// A rich edit control groups consecutive typing actions, including characters deleted by using the BackSpace key, into a /// single undo action until one of the following events occurs: /// /// /// /// The control receives an EM_STOPGROUPTYPING message. /// /// /// The control loses focus. /// /// /// The user moves the current selection, either by using the arrow keys or by clicking the mouse. /// /// /// The user presses the Delete key. /// /// /// The user performs any other action, such as a paste operation that does not involve typing. /// /// /// /// You can send the EM_STOPGROUPTYPING message to break consecutive typing actions into smaller undo groups. For example, you /// could send EM_STOPGROUPTYPING after each character or at each word break. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-stopgrouptyping [MsgParams()] EM_STOPGROUPTYPING = WindowMessage.WM_USER + 88, /// /// Sets the text mode or undo level of a rich edit control. The message fails if the control contains any text. /// Parameters /// wParam /// /// One or more values from the TEXTMODE enumeration type. The values specify the new settings for the control's text mode and /// undo level parameters. /// /// /// Specify one of the following values to set the text mode parameter. If you do not specify a text mode value, the text mode /// remains at its current setting. /// /// /// /// Value /// Meaning /// /// /// TM_PLAINTEXT /// /// Indicates plain text mode, in which the control is similar to a standard edit control. For more information about plain text /// mode, see the following Remarks section. /// /// /// /// TM_RICHTEXT /// /// Indicates rich text mode, in which the control has standard rich edit functionality. Rich text mode is the default setting. /// /// /// /// /// Specify one of the following values to set the undo level parameter. If you do not specify an undo level value, the undo level /// remains at its current setting. /// /// /// /// Value /// Meaning /// /// /// TM_SINGLELEVELUNDO /// The control allows the user to undo only the last action that can be undone. /// /// /// TM_MULTILEVELUNDO /// /// The control supports multiple undo operations. This is the default setting. Use the EM_SETUNDOLIMIT message to set the /// maximum number of undo actions. /// /// /// /// /// Specify one of the following values to set the code page parameter. If you do not specify an code page value, the code page /// remains at its current setting. /// /// /// /// Value /// Meaning /// /// /// TM_SINGLECODEPAGE /// /// The control only allows the English keyboard and a keyboard corresponding to the default character set. For example, you could /// have Greek and English. Note that this prevents Unicode text from entering the control. For example, use this value if a Rich /// Edit control must be restricted to ANSI text. /// /// /// /// TM_MULTICODEPAGE /// The control allows multiple code pages and Unicode text into the control. This is the default setting. /// /// /// lParam /// This parameter is not used; it must be zero. /// Returns /// If the message succeeds, the return value is zero. /// If the message fails, the return value is a nonzero value. /// /// /// /// In rich text mode, a rich edit control has standard rich edit functionality. However, in plain text mode, the control is similar /// to a standard edit control: /// /// /// /// The text in a plain text control can have only one format (such as Bold, 10pt Arial). /// /// /// /// The user cannot paste rich text formats, such as Rich Text Format (RTF) or embedded objects into a plain text control. /// /// /// /// /// Rich text mode controls always have a default end-of-document marker or carriage return, to format paragraphs. Plain text /// controls, on the other hand, do not need the default, end-of-document marker, so it is omitted. /// /// /// /// /// The control must contain no text when it receives the EM_SETTEXTMODE message. To ensure there is no text, send a /// WM_SETTEXT message with an empty string (""). /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settextmode [MsgParams(typeof(TEXTMODE), null)] EM_SETTEXTMODE = WindowMessage.WM_USER + 89, /// /// Gets the current text mode and undo level of a rich edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// /// The return value is one or more values from the TEXTMODE enumeration type. The values indicate the current text mode and /// undo level of the control. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextmode [MsgParams(LResultType = typeof(TEXTMODE))] EM_GETTEXTMODE = WindowMessage.WM_USER + 90, /// /// Enables or disables automatic detection of hyperlinks by a rich edit control. /// Parameters /// wParam /// Specify 0 to disable automatic link detection, or one of the following values to enable various kinds of detection. /// /// /// Value /// Meaning /// /// /// AURL_DISABLEMIXEDLGC /// /// Windows 8: Disable recognition of domain names that contain labels with characters belonging to more than one of the /// following scripts: Latin, Greek, and Cyrillic. /// /// /// /// AURL_ENABLEDRIVELETTERS /// Windows 8: Recognize file names that have a leading drive specification, such as c:\temp. /// /// /// AURL_ENABLEEA /// This value is deprecated; use AURL_ENABLEEAURLS instead. /// /// /// AURL_ENABLEEAURLS /// Recognize URLs that contain East Asian characters. /// /// /// AURL_ENABLEEMAILADDR /// Windows 8: Recognize email addresses. /// /// /// AURL_ENABLETELNO /// Windows 8: Recognize telephone numbers. /// /// /// AURL_ENABLEURL /// Windows 8: Recognize URLs that include the path. /// /// /// lParam /// /// This parameter determines the URL schemes recognized if AURL_ENABLEURL is active. If lParam is NULL, the default scheme /// name list is used (see Remarks). Alternatively, lParam can point to a null-terminated string consisting of up to 50 /// colon-terminated scheme names that supersede the default scheme name list. For example, the string could be /// "news:http:ftp:telnet:". The scheme name syntax is defined in the Uniform Resource Identifiers (URI): Generic Syntax document on /// The Internet Engineering Task Force (IETF) website. Specifically, a scheme name can contain up to 13 characters (including the /// colon), must start with an ASCII alphabetic, and can be followed by a mixture of ASCII alphabetics, digits, and the three /// punctuation characters: ".", "+", and "-". The string type can be either char* or WCHAR*; the rich edit control /// automatically detects the type. /// /// Returns /// If the message succeeds, the return value is zero. /// /// If the message fails, the return value is a nonzero value. For example, the message might fail due to insufficient memory, an /// invalid detection option, or an invalid scheme-name string. /// /// If lParam contains more than 50 scheme names, the message fails with a return value of E_INVALIDARG. /// /// /// /// If automatic URL detection is enabled (that is, wParam includes AURL_ENABLEURL), the rich edit control scans any modified /// text to determine whether the text matches the format of a URL (or more generally in Windows 8 or later an IRI International /// Resource Identifier). If lParam is NULL, the control detects URLs that begin with the following scheme names: /// /// /// /// callto /// /// /// file /// /// /// ftp /// /// /// gopher /// /// /// http /// /// /// https /// /// /// mailto /// /// /// news /// /// /// notes /// /// /// nntp /// /// /// onenote /// /// /// outlook /// /// /// prospero /// /// /// tel /// /// /// telnet /// /// /// wais /// /// /// webcal /// /// /// /// When automatic link detection is enabled, the rich edit control removes the CFE_LINK effect from modified text that does /// not have a format recognized by the control. If your application uses the CFE_LINK effect to mark other types of text, do /// not enable automatic link detection. The rich edit control does not check whether a detected link exists; that responsibility /// belongs to the client. /// /// /// A rich edit control sends the EN_LINK notification when it receives various messages while the mouse pointer is over text that /// has the CFE_LINK effect. For more information, see Automatic RichEdit Hyperlinks and RichEdit Friendly Name Hyperlinks. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-autourldetect [MsgParams(typeof(AURL), typeof(IntPtr))] EM_AUTOURLDETECT = WindowMessage.WM_USER + 91, /// /// Indicates whether the auto URL detection is turned on in the rich edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// If auto-URL detection is active, the return value is 1. /// If auto-URL detection is inactive, the return value is 0. /// /// /// /// When auto URL detection is on, Microsoft Rich Edit is constantly checking typed text for a valid URL. Rich Edit recognizes URLs /// that start with these prefixes: /// /// /// /// http: /// /// /// file: /// /// /// mailto: /// /// /// ftp: /// /// /// https: /// /// /// gopher: /// /// /// nntp: /// /// /// prospero: /// /// /// telnet: /// /// /// news: /// /// /// wais: /// /// /// outlook: /// /// /// /// Rich Edit also recognizes standard path names that start with \\. When Rich Edit locates a URL, it changes the URL text color, /// underlines the text, and notifies the client using EN_LINK. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getautourldetect [MsgParams(LResultType = typeof(BOOL))] EM_GETAUTOURLDETECT = WindowMessage.WM_USER + 92, /// /// Changes the palette that a rich edit control uses for its display window. /// Parameters /// wParam /// Handle to the new palette used by the rich edit control. /// lParam /// This parameter is not used; it must be zero. /// Returns /// This message does not return a value. /// /// The rich edit control does not check whether the new palette is valid. // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpalette [MsgParams(typeof(HPALETTE), null)] EM_SETPALETTE = WindowMessage.WM_USER + 93, /// /// Gets the text from a rich edit control. /// Parameters /// wParam /// Pointer to a GETTEXTEX structure, which indicates how to translate the text before putting it into the output buffer. /// lParam /// /// Pointer to the buffer to receive the text. The size of this buffer, in bytes, is specified by the cb member of the /// GETTEXTEX structure. Use the EM_GETTEXTLENGTHEX message to get the required size of the buffer. /// /// Returns /// The return value is the number of TCHAR s copied into the output buffer, not including the null terminator. /// /// /// /// If the size of the output buffer is less than the size of the text in the control, the edit control will copy text from its /// beginning and place it in the buffer until the buffer is full. A terminating null character will still be placed at the end of /// the buffer. /// /// /// If ANSI text is requested, EM_GETTEXTEX uses the WideCharToMultiByte function to translate the Unicode characters /// to ANSI. It allows you to go from Unicode to ANSI using a particular code page. The GETTEXTEX structure contains members ( /// lpDefaultChar and lpUsedDefChar) that are used in the translation from Unicode to ANSI. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextex [MsgParams(typeof(GETTEXTEX?), typeof(IntPtr))] EM_GETTEXTEX = WindowMessage.WM_USER + 94, /// /// Calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control. /// Parameters /// wParam /// Pointer to a GETTEXTLENGTHEX structure that receives the text length information. /// lParam /// This parameter is not used; it must be zero. /// Returns /// /// The message returns the number of TCHAR s in the edit control, depending on the setting of the flags in the /// GETTEXTLENGTHEX structure. If incompatible flags were set in the flags member, the message returns E_INVALIDARG . /// /// /// /// This message is a fast and easy way to determine the number of characters in the Unicode version of the rich edit control. /// However, for a non-Unicode target code page you will potentially be converting to a combination of single-byte and double-byte characters. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettextlengthex [MsgParams(typeof(GETTEXTLENGTHEX?), null)] EM_GETTEXTLENGTHEX = WindowMessage.WM_USER + 95, /// /// Shows or hides one of the scroll bars in the host window of a rich edit control. /// Parameters /// wParam /// Identifies which scroll bar to display: horizontal or vertical. This parameter must be SB_VERT or SB_HORZ. /// lParam /// /// Specifies whether to show the scroll bar or hide it. Specify TRUE to show the scroll bar and FALSE to hide it. /// /// Returns /// This message does not return a value. /// /// This method is only valid when the control is in-place active. Calls made while the control is inactive may fail. // https://learn.microsoft.com/en-us/windows/win32/controls/em-showscrollbar [MsgParams(typeof(SB), typeof(BOOL), LResultType = null)] EM_SHOWSCROLLBAR = WindowMessage.WM_USER + 96, /// /// Combines the functionality of the WM_SETTEXT and EM_REPLACESEL messages, and adds the ability to set text using a /// code page and to use either rich text or plain text. /// Parameters /// wParam /// Pointer to a SETTEXTEX structure that specifies flags and an optional code page to use in translating to Unicode. /// lParam /// /// Pointer to the null-terminated text to insert. This text is an ANSI string, unless the code page is 1200 (Unicode). If lParam /// starts with a valid RTF ASCII sequence for example, "{\rtf" or "{urtf" the text is read in using the RTF reader. /// /// Returns /// If the operation is setting all of the text and succeeds, the return value is 1. /// If the operation is setting the selection and succeeds, the return value is the number of bytes or characters copied. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settextex [MsgParams(typeof(SETTEXTEX?), typeof(IntPtr))] EM_SETTEXTEX = WindowMessage.WM_USER + 97, /// /// Sets the punctuation characters for a rich edit control. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. /// /// /// Parameters /// wParam /// Specifies the punctuation type, which can be one of the following values. /// /// /// Value /// Meaning /// /// /// PC_LEADING /// Leading punctuation characters. /// /// /// PC_FOLLOWING /// Following punctuation characters. /// /// /// PC_DELIMITER /// Delimiter. /// /// /// PC_OVERFLOW /// Not supported. /// /// /// lParam /// Pointer to a PUNCTUATION structure that contains the punctuation characters. /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpunctuation [MsgParams(typeof(PUNC), typeof(PUNCTUATION?))] EM_SETPUNCTUATION = WindowMessage.WM_USER + 100, /// /// Gets the current punctuation characters for the rich edit control. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions /// of Rich Edit. /// /// /// Parameters /// wParam /// The punctuation type can be one of the following values. /// /// /// Value /// Meaning /// /// /// PC_LEADING /// Leading punctuation characters /// /// /// PC_FOLLOWING /// Following punctuation characters /// /// /// PC_DELIMITER /// Delimiter /// /// /// PC_OVERFLOW /// Not supported /// /// /// lParam /// Pointer to a PUNCTUATION structure that receives the punctuation characters. /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getpunctuation [MsgParams(typeof(PUNC), typeof(PUNCTUATION?))] EM_GETPUNCTUATION = WindowMessage.WM_USER + 101, /// /// Sets the word-wrapping and word-breaking options for a rich edit control. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. /// /// /// Parameters /// wParam /// Specifies one or more of the following values. /// /// /// Value /// Meaning /// /// /// WBF_WORDWRAP /// Enables Asian-specific word wrap operations, such as kinsoku in Japanese. /// /// /// WBF_WORDBREAK /// Enables English word-breaking operations in Japanese and Chinese. Enables Hangeul word-breaking operation. /// /// /// WBF_OVERFLOW /// Recognizes overflow punctuation. (Not currently supported.) /// /// /// WBF_LEVEL1 /// Sets the Level 1 punctuation table as the default. /// /// /// WBF_LEVEL2 /// Sets the Level 2 punctuation table as the default. /// /// /// WBF_CUSTOM /// Sets the application-defined punctuation table. /// /// /// lParam /// This parameter is not used; it must be zero. /// Returns /// This message returns the current word-wrapping and word-breaking options. /// /// This message must not be sent by the application defined word breaking procedure. // https://learn.microsoft.com/en-us/windows/win32/controls/em-setwordwrapmode [MsgParams(typeof(WBF), null, LResultType = typeof(WBF))] EM_SETWORDWRAPMODE = WindowMessage.WM_USER + 102, /// /// Gets the current word wrap and word-break options for the rich edit control. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions /// of Rich Edit. /// /// /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// The message returns the current word wrap and word-break options. /// /// This message must not be sent by the application-defined, word-break procedure. // https://learn.microsoft.com/en-us/windows/win32/controls/em-getwordwrapmode [MsgParams(LResultType = typeof(WBF))] EM_GETWORDWRAPMODE = WindowMessage.WM_USER + 103, /// /// Sets the Input Method Editor (IME) composition color for a rich edit control. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. /// /// /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// Pointer to a COMPCOLOR structure that contains the composition color to be set. /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimecolor [MsgParams(null, typeof(COMPCOLOR?))] EM_SETIMECOLOR = WindowMessage.WM_USER + 104, /// /// Retrieves the Input Method Editor (IME) composition color. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions /// of Rich Edit. /// /// /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// A four-element array of COMPCOLOR structures that receives the composition color. /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/Controls/em-getimecolor [MsgParams(null, typeof(COMPCOLOR[]))] EM_GETIMECOLOR = WindowMessage.WM_USER + 105, /// /// Sets the Input Method Editor (IME) options. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions. /// /// /// Parameters /// wParam /// Specifies one of the following values. /// /// /// Value /// Meaning /// /// /// ECOOP_SET /// Sets the options to those specified by lParam. /// /// /// ECOOP_OR /// Combines the specified options with the current options. /// /// /// ECOOP_AND /// Retains only those current options that are also specified by lParam. /// /// /// ECOOP_XOR /// Logically exclusive OR the current options with those specified by lParam. /// /// /// lParam /// Specifies one of more of the following values. /// /// /// Value /// Meaning /// /// /// IMF_CLOSESTATUSWINDOW /// Closes the IME status window when the control receives the input focus. /// /// /// IMF_FORCEACTIVE /// Activates the IME when the control receives the input focus. /// /// /// IMF_FORCEDISABLE /// Disables the IME when the control receives the input focus. /// /// /// IMF_FORCEENABLE /// Enables the IME when the control receives the input focus. /// /// /// IMF_FORCEINACTIVE /// Inactivates the IME when the control receives the input focus. /// /// /// IMF_FORCENONE /// Disables IME handling. /// /// /// IMF_FORCEREMEMBER /// Restores the previous IME status when the control receives the input focus. /// /// /// IMF_MULTIPLEEDIT /// /// Specifies that the composition string will not be canceled or determined by focus changes. This allows an application to have /// separate composition strings on each rich edit control. /// /// /// /// IMF_VERTICAL /// Note used in Rich Edit 2.0 and later. /// /// /// Returns /// If the operation succeeds, the return value is a nonzero value. /// If the operation fails, the return value is zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimeoptions [MsgParams(typeof(ECOOP), typeof(IMF))] EM_SETIMEOPTIONS = WindowMessage.WM_USER + 106, /// /// Retrieves the current Input Method Editor (IME) options. /// /// Note /// /// This message is supported only in Asian-language versions of Microsoft Rich Edit 1.0. It is not supported in any later versions /// of Rich Edit. /// /// /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// This message returns one or more of the IME option flag values described in the EM_SETIMEOPTIONS message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimeoptions [MsgParams(LResultType = typeof(IMF))] EM_GETIMEOPTIONS = WindowMessage.WM_USER + 107, /// This message is not implemented. // https://learn.microsoft.com/en-us/windows/win32/controls/em-convposition EM_CONVPOSITION = WindowMessage.WM_USER + 108, /// /// Sets options for Input Method Editor (IME) and Asian language support in a rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// Specifies the language options. For a list of possible values, see EM_GETLANGOPTIONS. /// Returns /// This message returns a value of 1. /// /// /// The EM_SETLANGOPTIONS message controls the following: /// /// /// Automatic font binding. /// /// /// Automatic keyboard switching. /// /// /// Automatic font size adjustment. /// /// /// Use of user-interface default fonts instead of document default fonts. /// /// /// Notifications to client during IME composition. /// /// /// How IME aborts composition mode. /// /// /// Spell checking, autocorrect, and touch keyboard prediction. /// /// /// /// This message sets the values of all language option flags. To change a subset of the flags, send the EM_GETLANGOPTIONS /// message to get the current option flags, change the flags that you need to change, and then send the EM_SETLANGOPTIONS /// message with the result. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setlangoptions [MsgParams(null, typeof(IMF))] EM_SETLANGOPTIONS = WindowMessage.WM_USER + 120, /// /// Gets a rich edit control's option settings for Input Method Editor (IME) and Asian language support. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Returns the IME and Asian language settings, which can be zero or more of the following values. /// /// /// Return code /// Description /// /// /// IMF_AUTOFONT /// /// If this flag is set, the control automatically changes fonts when the user explicitly changes to a different keyboard layout. It /// is useful to turn off IMF_AUTOFONT for universal Unicode fonts. This option is turned on by default (1). /// /// /// /// IMF_AUTOFONTSIZEADJUST /// /// If this flag is set, the control scales font-bound font sizes from insertion point size according to script. For example, Asian /// fonts are slightly larger than Western ones. This option is turned on by default (1). /// /// /// /// IMF_AUTOKEYBOARD /// /// If this flag is set, the control automatically changes the keyboard layout when the user explicitly changes to a different font, /// or when the user explicitly changes the insertion point to a new location in the text. Will be turned on automatically for /// bidirectional controls. For all other controls, it is turned off by default. This option is turned off by default (0). /// /// /// /// IMF_DISABLEAUTOBIDIAUTOKEYBOARD /// /// Windows 8: If this flag is set, the control uses language neutral logic for automatic keyboard switching. This option is /// turned off by default (0). /// /// /// /// IMF_DUALFONT /// /// If this flag is set, the control uses dual-font mode. Used for Asian language support. The control uses an English font for ASCII /// text and a Asian font for Asian text. This option is turned on by default (1). /// /// /// /// IMF_IMEALWAYSSENDNOTIFY /// /// This flag controls how the rich edit control notifies the client during IME composition: 0: No EN_CHANGE or EN_SELCHANGE /// notifications during undetermined state. Send notification when the final string comes in. This is the default. 1: Send EN_CHANGE /// and EN_SELCHANGE events during undetermined state. /// /// /// /// IMF_IMECANCELCOMPLETE /// /// This flag determines how the control uses the composition string of an IME if the user cancels it. If this flag is set, the /// control discards the composition string. If this flag is not set, the control uses the composition string as the result string. /// This option is turned off by default (0). /// /// /// /// IMF_NOIMPLICITLANG /// /// Windows 8: If this flag is set, disable stamping keyboard input with the keyboard language and ensuring that non-East /// Asian language IDss are compatible with the character repertoire. This option is turned off by default (0). /// /// /// /// IMF_NOKBDLIDFIXUP /// /// Windows 8: If this flag is set, the rich edit control disables stamping keyboard language on an empty control. This option /// is turned off by default (0). /// /// /// /// IMF_SPELLCHECKING /// /// Windows 8: If this flag is set, the rich edit control turns on spell checking. This option is turned off by default (0). /// /// /// /// IMF_TKBAUTOCORRECTION /// /// Windows 8: If this flag is set, enable touch keyboard autocorrect. This option is turned off by default (0). /// /// /// /// IMF_TKBPREDICTION /// /// Windows 10: Ignored. Windows 8: If this flag is set, the rich edit control enables touch keyboard prediction. This /// option is turned off by default (0). /// /// /// /// IMF_UIFONTS /// Use user-interface default fonts. This option is turned off by default (0). /// /// /// /// /// The IMF_AUTOFONT flag is set by default. The IMF_AUTOKEYBOARD and IMF_IMECANCELCOMPLETE flags are cleared by default. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getlangoptions [MsgParams(LResultType = typeof(IMF))] EM_GETLANGOPTIONS = WindowMessage.WM_USER + 121, /// /// Retrieves the current Input Method Editor (IME) mode for a rich edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// The return value is one of the following values. /// /// /// Return code /// Description /// /// /// ICM_NOTOPEN /// IME is not open. /// /// /// ICM_LEVEL3 /// True inline mode. /// /// /// ICM_LEVEL2 /// Level 2. /// /// /// ICM_LEVEL2_5 /// Level 2.5 /// /// /// ICM_LEVEL2_SUI /// Special UI. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimecompmode [MsgParams(LResultType = typeof(ICM))] EM_GETIMECOMPMODE = WindowMessage.WM_USER + 122, /// /// Finds Unicode text within a rich edit control. /// Parameters /// wParam /// Specifies the parameters of the search operation. This parameter can be one or more of the following values. /// /// /// Value /// Meaning /// /// /// FR_DOWN /// /// If set, the operation searches from the end of the current selection to the end of the document. If not set, the operation /// searches from the end of the current selection to the beginning of the document. /// /// /// /// FR_MATCHALEFHAMZA /// /// By default, Arabic and Hebrew alefs with different accents are all matched by the alef character. Set this flag if you want the /// search to differentiate between alefs with different accents. /// /// /// /// FR_MATCHCASE /// If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive. /// /// /// FR_MATCHDIAC /// /// By default, Arabic and Hebrew diacritical marks are ignored. Set this flag if you want the search operation to consider /// diacritical marks. /// /// /// /// FR_MATCHKASHIDA /// /// By default, Arabic and Hebrew kashidas are ignored. Set this flag if you want the search operation to consider kashidas. /// /// /// /// FR_WHOLEWORD /// /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for /// word fragments that match the search string. /// /// /// /// lParam /// A FINDTEXTW structure containing information about the find operation. /// Returns /// /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is /// not found, the return value is -1. /// /// /// /// EM_FINDTEXTW uses the FINDTEXTW structure, while EM_FINDTEXTEXW uses the FINDTEXTEXW structure. The /// difference is that FINDTEXTEXW reports back the range of text that was found. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtextw [MsgParams(typeof(FR), typeof(FINDTEXT?))] EM_FINDTEXTW = WindowMessage.WM_USER + 123, /// /// Finds Unicode text within a rich edit control. /// Parameters /// wParam /// Specifies the behavior of the search operation. This parameter can be one or more of the following values. /// /// /// Value /// Meaning /// /// /// FR_DOWN /// /// Microsoft Rich Edit 2.0 and later: If set, the search is forward from FINDTEXTEX.chrg.cpMin; if not set, the search is /// backward from FINDTEXTEX.chrg.cpMin. Microsoft Rich Edit 1.0: The FR_DOWN flag is ignored. The search is always forward. /// /// /// /// FR_MATCHALEFHAMZA /// /// If set, the search differentiates between alefs with different accents. If not set, Arabic and Hebrew alefs with different /// accents are all matched by the alef character. /// /// /// /// FR_MATCHCASE /// If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive. /// /// /// FR_MATCHDIAC /// /// If set, the search operation considers diacritical marks. If not set, Arabic and Hebrew diacritical marks are ignored. /// /// /// /// FR_MATCHKASHIDA /// If set, the search operation considers kashidas. If not set, Arabic and Hebrew kashidas are ignored. /// /// /// FR_WHOLEWORD /// /// If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for /// word fragments that match the search string. /// /// /// /// lParam /// A FINDTEXTEXW structure containing information about the find operation. /// Returns /// /// If the target string is found, the return value is the zero-based position of the first character of the match. If the target is /// not found, the return value is -1. /// /// /// /// Use this message to find Unicode strings. For ANSI;, use EM_FINDTEXTEX. /// /// The cpMin member of FINDTEXTEX.chrg always specifies the starting-point of the search, and cpMax specifies /// the end point. When searching backward, cpMin must be equal to or greater than cpMax. When searching forward, a /// value of -1 in cpMax extends the search range to the end of the text. /// /// /// If the search operation finds a match, the chrgText member of the FINDTEXTEX structure returns the range of /// character positions that contains the matching text. /// /// /// EM_FINDTEXTEXW uses the FINDTEXTEXW structure, while EM_FINDTEXTW uses the FINDTEXTW structure. The /// difference is that EM_FINDTEXTEXW reports the range of text that was found. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-findtextexw [MsgParams(typeof(FR), typeof(FINDTEXTEX?))] EM_FINDTEXTEXW = WindowMessage.WM_USER + 124, /// /// Invokes the Input Method Editor (IME) reconversion dialog box. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// This message always returns zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-reconversion [MsgParams()] EM_RECONVERSION = WindowMessage.WM_USER + 125, /// /// Set the Input Method Editor (IME) mode bias for a rich edit control. /// Parameters /// wParam /// IME mode bias value. It can be one of the following. /// /// /// Value /// Meaning /// /// /// IMF_SMODE_PLAURALCLAUSE /// Sets the IME mode bias to Name. /// /// /// IMF_SMODE_NONE /// No bias. /// /// /// lParam /// This must be the same value as wParam. /// Returns /// This message returns the new IME mode bias setting. /// /// /// /// When the IME generates a list of alternative choices for a set of characters, this message sets the criteria by which some of the /// choices will appear at the top of the list. /// /// To set the Text Services Framework (TSF) mode bias, use EM_SETCTFMODEBIAS. /// The application should call EM_ISIME before calling this function. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setimemodebias [MsgParams(typeof(IMF_SMODE), typeof(IMF_SMODE), LResultType = typeof(IMF_SMODE))] EM_SETIMEMODEBIAS = WindowMessage.WM_USER + 126, /// /// Retrieves the Input Method Editor (IME) mode bias for a Microsoft Rich Edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// This message returns the current IME mode bias setting. /// /// /// To get the Text Services Framework mode bias, use EM_GETCTFMODEBIAS. /// The application should call EM_ISIME before calling this function. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimemodebias [MsgParams(LParamType = typeof(IMF_SMODE))] EM_GETIMEMODEBIAS = WindowMessage.WM_USER + 127, /// /// The EM_SETBIDIOPTIONS message sets the current state of the bidirectional options in the rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a BIDIOPTIONS structure that indicates how to set the state of the bidirectional options in the rich edit control. /// /// Returns /// This message does not return a value. /// /// /// The rich edit control must be in plain text mode or EM_SETBIDIOPTIONS will not do anything. /// /// In plain text controls, EM_SETBIDIOPTIONS automatically determines the paragraph direction and/or alignment based on the /// context rules. These rules state that the direction and/or alignment is derived from the first strong character in the control. A /// strong character is one from which text direction can be determined (see Unicode Standard version 2.0). The paragraph direction /// and/or alignment is applied to the default format. /// /// EM_SETBIDIOPTIONS only switches the default paragraph format to RTL (right to left) if it finds an RTL character, /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setbidioptions [MsgParams(null, typeof(BIDIOPTIONS?), LResultType = null)] EM_SETBIDIOPTIONS = WindowMessage.WM_USER + 200, /// /// Indicates the current state of the bidirectional options in the rich edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// A BIDIOPTIONS structure that receives the current state of the bidirectional options in the rich edit control. /// Returns /// This message does not return a value. /// /// /// This message sets the values of the wMask and wEffects members to the value of the current state of the /// bidirectional options in the rich edit control. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getbidioptions [MsgParams(null, typeof(BIDIOPTIONS), LResultType = null)] EM_GETBIDIOPTIONS = WindowMessage.WM_USER + 201, /// /// Sets the current state of the typography options of a rich edit control. /// Parameters /// wParam /// Specifies one or both of the following values. /// /// /// Value /// Meaning /// /// /// TO_ADVANCEDTYPOGRAPHY /// Advanced line breaking and line formatting is turned on. /// /// /// TO_SIMPLELINEBREAK /// Faster line breaking for simple text (requires TO_ADVANCEDTYPOGRAPHY). /// /// /// lParam /// /// A mask consisting of one or more of the flags in wParam. Only the flags that are set in this mask will be set or cleared. This /// allows a single flag to be set or cleared without reading the current flag states. /// /// Returns /// Returns TRUE if wParam is valid, otherwise FALSE. /// /// /// Advanced line breaking is turned on automatically by the rich edit control when needed, such as for handling complex scripts like /// Arabic and Hebrew, and for mathematics. It s also needed for justified paragraphs, hyphenation, and other typographic features. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settypographyoptions [MsgParams(typeof(TO), typeof(TO), LResultType = typeof(BOOL))] EM_SETTYPOGRAPHYOPTIONS = WindowMessage.WM_USER + 202, /// /// Returns the current state of the typography options of a rich edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Returns the current typography options. For a list of options, see EM_SETTYPOGRAPHYOPTIONS. /// /// /// You can turn on advanced line breaking by sending the EM_SETTYPOGRAPHYOPTIONS message. Advanced and normal line breaking /// may also be turned on automatically by the rich edit control if it is needed for certain languages. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettypographyoptions [MsgParams(LResultType = typeof(TO))] EM_GETTYPOGRAPHYOPTIONS = WindowMessage.WM_USER + 203, /// /// Sets the current edit style flags for a rich edit control. /// Parameters /// wParam /// Specifies one or more edit style flags. For a list of possible values, see EM_GETEDITSTYLE. /// lParam /// /// A mask consisting of one or more of the wParam values. Only the values specified in this mask will be set or cleared. This allows /// a single flag to be set or cleared without reading the current flag states. /// /// Returns /// /// The return value is the state of the edit style flags after the rich edit control has attempted to implement your edit style /// changes. The edit style flags are a set of flags that indicate the current edit style. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-seteditstyle [MsgParams(typeof(SES), typeof(SES), LResultType = typeof(SES))] EM_SETEDITSTYLE = WindowMessage.WM_USER + 204, /// /// Retrieves the current edit style flags. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Returns the current edit style flags, which can include one or more of the following values: /// /// /// Return code /// Description /// /// /// SES_BEEPONMAXTEXT /// Rich Edit will call the system beeper if the user attempts to enter more than the maximum characters. /// /// /// SES_BIDI /// /// Turns on bidirectional processing. This is automatically turned on by Rich Edit if any of the following window styles are active: /// WS_EX_RIGHT, WS_EX_RTLREADING, WS_EX_LEFTSCROLLBAR. However, this setting is useful for handling these /// window styles when using a custom implementation of ITextHost (default: 0). /// /// /// /// SES_CTFALLOWEMBED /// Windows XP with SP1: Allow embedded objects to be inserted using TSF (default: 0). /// /// /// SES_CTFALLOWPROOFING /// Windows XP with SP1: Allows TSF proofing tips (default: 0). /// /// /// SES_CTFALLOWSMARTTAG /// Windows XP with SP1: Allows TSF SmartTag tips (default: 0). /// /// /// SES_CTFNOLOCK /// Windows 8: Do not allow the TSF lock read/write access. This pauses TSF input. /// /// /// SES_DEFAULTLATINLIGA /// /// Windows 8: Fonts with an fi ligature are displayed with default OpenType features resulting in improved typography /// (default: 0). /// /// /// /// SES_DRAFTMODE /// /// Windows XP with SP1: Use draft mode fonts to display text. Draft mode is an accessibility option where the control /// displays the text with a single font; the font is determined by the system setting for the font used in message boxes. For /// example, accessible users may read text easier if it is uniform, rather than a mix of fonts and styles (default: 0). /// /// /// /// SES_EMULATE10 /// Windows 8: Emulate RichEdit 1.0 behavior. /// /// /// SES_EMULATESYSEDIT /// When this bit is on, rich edit attempts to emulate the system edit control (default: 0). /// /// /// SES_EXTENDBACKCOLOR /// Extends the background color all the way to the edges of the client rectangle (default: 0). /// /// /// SES_HIDEGRIDLINES /// /// Windows XP with SP1: If the width of table gridlines is zero, gridlines are not displayed. This is equivalent to the hide /// gridlines feature in Word's table menu (default: 0). /// /// /// /// SES_HYPERLINKTOOLTIPS /// /// Windows 8: When the cursor is over a link, display a tooltip with the target link address (default: 0). /// /// /// /// SES_LOGICALCARET /// /// Windows 8: Provide logical caret information instead of a caret bitmap as described in ITextHost::TxSetCaretPos /// (default: 0). /// /// /// /// SES_LOWERCASE /// Converts all input characters to lowercase (default: 0). /// /// /// SES_MAPCPS /// Obsolete. Do not use. /// /// /// SES_MULTISELECT /// /// Windows 8: Enable multiselection with individual mouse selections made while the Ctrl key is pressed (default: 0). /// /// /// /// SES_NOEALINEHEIGHTADJUST /// /// Windows 8: Do not adjust line height for East Asian text (default: 0 which adjusts the line height by 15%). /// /// /// /// SES_NOFOCUSLINKNOTIFY /// Sends EN_LINK notification from links that do not have focus. /// /// /// SES_NOIME /// Disallows IMEs for this instance of the rich edit control (default: 0). /// /// /// SES_NOINPUTSEQUENCECHK /// /// When this bit is on, rich edit does not verify the sequence of typed text. Some languages (such as Thai and Vietnamese) require /// verifying the input sequence order before submitting it to the backing store (default: 0). /// /// /// /// SES_SCROLLONKILLFOCUS /// When KillFocus occurs, scroll to the beginning of the text (character position equal to 0) (default: 0). /// /// /// SES_SMARTDRAGDROP /// Windows 8: Add or delete a space according to the context when dropping text (default: 0). /// /// /// SES_USECRLF /// Obsolete. Do not use. /// /// /// SES_WORDDRAGDROP /// /// Windows 8: If word select is active, ensure that the drop location is at a word boundary (default: 0). /// /// /// /// SES_UPPERCASE /// Converts all input characters to uppercase (default: 0). /// /// /// SES_USEAIMM /// Uses the Active IMM input method component that ships with Internet Explorer 4.0 or later (default: 0). /// /// /// SES_USEATFONT /// /// Windows XP with SP1: Uses an @ font, which is designed for vertical text; this is used with the ES_VERTICAL window /// style. The name of an @ font begins with the @ symbol, for example, "@Batang" (default: 0, but is automatically turned on for /// vertical text layout). /// /// /// /// SES_USECTF /// Windows XP with SP1: Turns on TSF support. (default: 0) /// /// /// SES_XLTCRCRLFTOCR /// /// Turns on translation of CRCRLFs to CRs. When this bit is on and a file is read in, all instances of CRCRLF will be converted to /// hard CRs internally. This will affect the text wrapping. Note that if such a file is saved as plain text, the CRs will be /// replaced by CRLFs. This is the .txt standard for plain text (default: 0, which deletes CRCRLFs on input). /// /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-geteditstyle [MsgParams(LResultType = typeof(SES))] EM_GETEDITSTYLE = WindowMessage.WM_USER + 205, /// Undocumented EM_OUTLINE = WindowMessage.WM_USER + 220, /// /// Obtains the current scroll position of the edit control. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a POINT structure. After calling EM_GETSCROLLPOS, this parameters contains a point in the virtual text /// space of the document, expressed in pixels. This point will be the point that is currently located in the upper-left corner of /// the edit control window. /// /// Returns /// This message always returns 1. /// /// The values returned in the POINT structure are 16-bit values (even in the 32-bit wide fields). // https://learn.microsoft.com/en-us/windows/win32/controls/em-getscrollpos [MsgParams(null, typeof(POINT?))] EM_GETSCROLLPOS = WindowMessage.WM_USER + 221, /// /// Scrolls the contents of a rich edit control to the specified point. /// Parameters /// wParam /// This parameter is not used; it must be zero. /// lParam /// /// Pointer to a POINT structure which specifies a point in the virtual text space of the document, expressed in pixels. The /// document will be scrolled until this point is located in the upper-left corner of the edit control window. If you want to change /// the view such that the upper left corner of the view is two lines down and one character in from the left edge. You would pass a /// point of (7, 22). /// /// /// The rich edit control checks the x and y coordinates and adjusts them if necessary, so that a complete line is displayed at the /// top. It also ensures that the text is never completely scrolled off the view rectangle. /// /// Returns /// This message always returns 1. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setscrollpos [MsgParams(null, typeof(POINT?))] EM_SETSCROLLPOS = WindowMessage.WM_USER + 222, /// /// Sets the font size for the selected text in a rich edit control. /// Parameters /// wParam /// /// Change in point size of the selected text. The result will be rounded according to values shown in the following table. This /// parameter should be in the range of -1637 to 1638. The resulting font size will be within the range of 1 to 1638. /// /// lParam /// This parameter is not used; it must be zero. /// Returns /// If no error occurred, the return value is TRUE. /// If an error occurred, the return value is FALSE. /// /// /// You can easily get the font size by sending the EM_GETCHARFORMAT message. /// /// Rich Edit first adds wParam to the current font size and then uses the resulting size and the following table to determine the /// rounding value. /// /// /// /// Band /// Rounding value /// /// /// <=12 /// 1 /// /// /// 28 /// 2 /// /// /// 36 /// 0 /// /// /// 48 /// 0 /// /// /// 72 /// 0 /// /// /// 80 /// 0 /// /// /// > 80 /// 10 /// /// /// /// If the resulting font size is not evenly divisible by the rounding value, the font size is then rounded to a number evenly /// divisible by the rounding value. So if the font size is less than or equal to 12, the rounding value will be 1. Similarly, if the /// font size is less than or equal to 28, the rounding value is 2. For values greater than 28, font sizes are rounded to the next /// band. So, the font size jumps to 36, 48, 72, 80. After 80, all rounding is done in increments of ten points. /// /// /// The font size is rounded up or down depending on the sign of wParam. If wParam is positive, the rounding is always up. Otherwise, /// rounding is always down. So, if the current font size is 10 and wParam is 3, the resulting font size would be 14 (10 + 3 = 13, /// which is not divisible by 2, so the size rounds up to 14). Conversely, if the current font size is 14 and wParam is -3, the /// resulting font size would be 10 (14 - 3 = 11, which is not divisible by 2, so the size rounds down to 10). /// /// /// The change is applied to each part of the selection. So, if some of the text is 10pt and some 20pt, after a call with wParam set /// to 1, the font sizes become 11pt and 22pt, respectively. /// /// Additional examples are shown in the following table. /// /// /// Original font size /// wParam /// Resulting font size /// /// /// 7 /// 1 /// 8 /// /// /// 7 /// 3 /// 10 /// /// /// 10 /// 3 /// 14 /// /// /// 14 /// -3 /// 10 /// /// /// 28 /// 1 /// 36 /// /// /// 28 /// 3 /// 36 /// /// /// 80 /// 1 /// 90 /// /// /// 80 /// -1 /// 72 /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setfontsize [MsgParams(typeof(short), null, LResultType = typeof(BOOL))] EM_SETFONTSIZE = WindowMessage.WM_USER + 223, /// /// Gets the current zoom ratio for a multiline edit control or a rich edit control. The zoom ration is always between 1/64 and 64. /// Parameters /// wParam /// Receives the numerator of the zoom ratio. /// lParam /// Receives the denominator of the zoom ratio. /// Returns /// The message returns TRUE if message is processed, which it will be if both wParam and lParam are not NULL. /// /// /// Edit: Supported in Windows 10 1809 and later. The edit control needs to have the ES_EX_ZOOMABLE extended style set, /// for this message to have an effect, see Edit Control Extended Styles. For information about the edit control, see Edit Controls. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getzoom [MsgParams(typeof(int), typeof(int), LResultType = typeof(BOOL))] EM_GETZOOM = WindowMessage.WM_USER + 224, /// /// Sets the zoom ratio for a multiline edit control or a rich edit control. The ratio must be a value between 1/64 and 64. The edit /// control needs to have the ES_EX_ZOOMABLE extended style set, for this message to have an effect, see Edit Control Extended Styles. /// Parameters /// wParam /// Numerator of the zoom ratio. /// lParam /// Denominator of the zoom ratio. These parameters can have the following values. /// /// /// Value /// Meaning /// /// /// Both 0 /// Turns off zooming by using the EM_SETZOOM message (zooming may still occur using TxGetExtent). /// /// /// 1/64 < (wParam / lParam) < 64 /// Zooms display by the zoom ratio numerator/denominator /// /// /// Returns /// If the new zoom setting is accepted, the return value is TRUE. /// If the new zoom setting is not accepted, the return value is FALSE. /// /// /// Edit: Supported in Windows 10 1809 and later. The edit control needs to have the ES_EX_ZOOMABLE extended style set, /// for this message to have an effect, see Edit Control Extended Styles. For information about the edit control, see Edit Controls. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setzoom [MsgParams(typeof(int), typeof(int), LResultType = typeof(BOOL))] EM_SETZOOM = WindowMessage.WM_USER + 225, /// Undocumented EM_GETVIEWKIND = WindowMessage.WM_USER + 226, /// Undocumented EM_SETVIEWKIND = WindowMessage.WM_USER + 227, /// Undocumented EM_GETPAGE = WindowMessage.WM_USER + 228, /// Undocumented EM_SETPAGE = WindowMessage.WM_USER + 229, /// /// Retrieves information about hyphenation for a Microsoft Rich Edit control. /// Parameters /// wParam /// The HYPHENATEINFO structure. /// lParam /// Not used; must be zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gethyphenateinfo [MsgParams(typeof(HYPHENATEINFO?), null, LResultType = null)] EM_GETHYPHENATEINFO = WindowMessage.WM_USER + 230, /// /// Sets the way a rich edit control does hyphenation. /// Parameters /// wParam /// Pointer to a HYPHENATEINFO structure. /// lParam /// Not used, must be zero. /// /// /// Note /// To enable hyphenation, the client must call EM_SETTYPOGRAPHYOPTIONS, specifying TO_ADVANCEDTYPOGRAPHY. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-sethyphenateinfo [MsgParams(typeof(HYPHENATEINFO?), null, LResultType = null)] EM_SETHYPHENATEINFO = WindowMessage.WM_USER + 231, /// /// /// [ EM_GETPAGEROTATE is available for use in the operating systems specified in the Requirements section. It may be altered /// or unavailable in subsequent versions.] /// /// Gets the text layout for a Microsoft Rich Edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Gets the current text layout. For a list of possible text layout values, see EM_SETPAGEROTATE. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getpagerotate [MsgParams(LResultType = typeof(EPR))] EM_GETPAGEROTATE = WindowMessage.WM_USER + 235, /// /// /// [ EM_SETPAGEROTATE is available for use in the operating systems specified in the Requirements section. It may be altered /// or unavailable in subsequent versions.] /// /// Sets the text layout for a rich edit control. /// Parameters /// wParam /// Text layout value. This can be one of the following values. /// /// /// Value /// Meaning /// /// /// EPR_0 /// Text flows from left to right and from top to bottom. /// /// /// EPR_90 /// Text flows from bottom to top and from left to right. /// /// /// EPR_180 /// Text flows from right to left and from bottom to top. /// /// /// EPR_270 /// Text flows from top to bottom and from right to left. /// /// /// EPR_SE /// Windows 8: Text flows top to bottom and left to right (Mongolian text layout). /// /// /// lParam /// Not used; must be zero. /// Returns /// Return value is the new text layout value. /// /// /// This message sets the text layout for the entire document. However, embedded contents are not rotated and must be rotated /// separately by the application. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setpagerotate [MsgParams(typeof(EPR), null, LResultType = null)] EM_SETPAGEROTATE = WindowMessage.WM_USER + 236, /// /// Gets the Text Services Framework mode bias values for a Microsoft Rich Edit control. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// The current Text Services Framework mode bias value. /// /// To get the IME mode bias, call EM_GETIMEMODEBIAS. // https://learn.microsoft.com/en-us/windows/win32/controls/em-getctfmodebias [MsgParams(LResultType = typeof(CTFMODEBIAS))] EM_GETCTFMODEBIAS = WindowMessage.WM_USER + 237, /// /// Sets the Text Services Framework (TSF) mode bias for a rich edit control. /// Parameters /// wParam /// Mode bias value. This can be one of the following values. /// /// /// Value /// Meaning /// /// /// CTFMODEBIAS_DEFAULT /// There is no mode bias. /// /// /// CTFMODEBIAS_FILENAME /// The bias is to a filename. /// /// /// CTFMODEBIAS_NAME /// The bias is to a name. /// /// /// CTFMODEBIAS_READING /// The bias is to the reading. /// /// /// CTFMODEBIAS_DATETIME /// The bias is to a date or time. /// /// /// CTFMODEBIAS_CONVERSATION /// The bias is to a conversation. /// /// /// CTFMODEBIAS_NUMERIC /// The bias is to a number. /// /// /// CTFMODEBIAS_HIRAGANA /// The bias is to hiragana strings. /// /// /// CTFMODEBIAS_KATAKANA /// The bias is to katakana strings. /// /// /// CTFMODEBIAS_HANGUL /// The bias is to Hangul characters. /// /// /// CTFMODEBIAS_HALFWIDTHKATAKANA /// The bias is to half-width katakana strings. /// /// /// CTFMODEBIAS_FULLWIDTHALPHANUMERIC /// The bias is to full-width alphanumeric characters. /// /// /// CTFMODEBIAS_HALFWIDTHALPHANUMERIC /// The bias is to half-width alphanumeric characters. /// /// /// lParam /// Not used; must be zero. /// Returns /// /// If successful, the return value is the new TSF mode bias value. If unsuccessful, the return value is the old TSF mode bias value. /// /// /// /// /// When a Microsoft Rich Edit application uses TSF, it can select the TSF mode bias. This message sets the criteria by which an /// alternative choice appears at the top of the list for selection. /// /// To set the mode bias for the Input Method Editor (IME), use EM_SETIMEMODEBIAS. /// // https://learn.microsoft.com/en-us/windows/win32/Controls/em-setctfmodebias [MsgParams(typeof(CTFMODEBIAS), null, LResultType = typeof(CTFMODEBIAS))] EM_SETCTFMODEBIAS = WindowMessage.WM_USER + 238, /// /// Determines if the Text Services Framework (TSF) keyboard is open or closed. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// If the TSF keyboard is open, the return value is TRUE. Otherwise, it is FALSE. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getctfopenstatus [MsgParams(LResultType = typeof(BOOL))] EM_GETCTFOPENSTATUS = WindowMessage.WM_USER + 240, /// /// Opens or closes the Text Services Framework (TSF) keyboard. /// Parameters /// wParam /// To turn on the TSF keyboard, use TRUE. To turn off the TSF keyboard, use FALSE. /// lParam /// Not used; must be zero. /// Returns /// If successful, this message returns TRUE. If unsuccessful, this message returns FALSE. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setctfopenstatus [MsgParams(typeof(BOOL), null, LResultType = typeof(BOOL))] EM_SETCTFOPENSTATUS = WindowMessage.WM_USER + 241, /// /// Retrieves the Input Method Editor (IME) composition text. /// Parameters /// wParam /// The IMECOMPTEXT structure. /// lParam /// /// The buffer that receives the composition text. The size of this buffer is contained in the cb member of the wParam structure. /// /// Returns /// If successful, the return value is the number of Unicode characters copied to the buffer. Otherwise, it is zero. /// /// /// This message only takes Unicode strings. /// /// Security Warning: Be sure to have a buffer sufficient for the size of the input. Failure to do so could cause problems for /// your application. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimecomptext [MsgParams(typeof(IMECOMPTEXT?), typeof(IntPtr))] EM_GETIMECOMPTEXT = WindowMessage.WM_USER + 242, /// /// Determine with a rich edit control's current input locale is an East Asian locale. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Returns TRUE if it is an East Asian locale. Otherwise, it returns FALSE. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-isime [MsgParams(LResultType = typeof(BOOL))] EM_ISIME = WindowMessage.WM_USER + 243, /// /// Retrieves the property and capabilities of the Input Method Editor (IME) associated with the current input locale. /// Parameters /// wParam /// Specifies the type of property information to retrieve. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// IGP_PROPERTY /// Property information. /// /// /// IGP_CONVERSION /// Conversion capabilities. /// /// /// IGP_SENTENCE /// Sentence mode capabilities. /// /// /// IGP_UI /// User interface capabilities. /// /// /// IGP_SETCOMPSTR /// Composition string capabilities. /// /// /// IGP_SELECT /// Selection inheritance capabilities. /// /// /// IGP_GETIMEVERSION /// Retrieves the system version number for which the specified IME was created. /// /// /// lParam /// Not used; must be zero. /// Returns /// /// Returns the property or capability value, depending on the value of the lParam parameter. For more information, see the Remarks. /// /// /// /// If wParam is IGP_PROPERTY, it returns one or more of the following values. /// /// /// Requirement /// Value /// /// /// IME_PROP_AT_CARET /// If set, conversion window is at the caret position. If clear, the window is near caret position. /// /// /// IME_PROP_SPECIAL_UI /// If set, IME has a nonstandard user interface. The application should not draw in the IME window. /// /// /// IME_PROP_CANDLIST_START_FROM_1 /// If set, strings in the candidate list are numbered starting at 1. If clear, strings start at zero. /// /// /// IME_PROP_UNICODE /// /// If set, the IME is viewed as a UnicodeIME. The system and the IME will communicate through the UnicodeIME interface. If clear, /// IME will use the ANSI interface to communicate with the system. /// /// /// /// IME_PROP_COMPLETE_ON_UNSELECT /// If set, conversion window is at the caret position. If clear, the window is near caret position. /// /// /// IME_PROP_ACCEPT_WIDE_VKEY /// /// If set, the IME processes the injected Unicode that came from the SendInput function by using VK_PACKET. If clear, the IME /// might not process the injected Unicode, and the injected Unicode might be sent to the application directly. /// /// /// /// If wParam is IGP_UI, it returns one or more of the following values. /// /// /// Requirement /// Value /// /// /// UI_CAP_2700 /// Supports text escapement values of 0 or 2700. For more information, see lfEscapement. /// /// /// UI_CAP_ROT90 /// Supports text escapement values of 0, 900, 1800, or 2700. For more information, see lfEscapement. /// /// /// UI_CAP_ROTANY /// Supports any text escapement value. For more information, see lfEscapement. /// /// /// If wParam is IGP_SETCOMPSTR, it returns one or more of the following values. /// /// /// Requirement /// Value /// /// /// SCS_CAP_COMPSTR /// /// Can create the composition string by calling the ImmSetCompositionString function with the SCS_SETSTR value. /// /// /// /// SCS_CAP_MAKEREAD /// /// Can create the reading string from corresponding composition string when using the ImmSetCompositionString function with /// SCS_SETSTR and without setting lpRead. /// /// /// /// SCS_CAP_SETRECONVERTSTRING /// This IME can support reconversion. Use ImmSetCompositionString to do the reconversion. /// /// /// If wParam is IGP_SELECT, it returns one or more of the following values. /// /// /// Requirement /// Value /// /// /// SELECT_CAP_CONVMODE /// Inherits conversion mode when a new IME is selected. /// /// /// SELECT_CAP_SENTENCE /// Inherits sentence mode when a new IME is selected. /// /// /// If wParam is IGP_GETIMEVERSION, it returns one or more of the following values. /// /// /// Requirement /// Value /// /// /// IMEVER_0310 /// The IME was created for Windows 3.1. /// /// /// IMEVER_0400 /// The IME was created for Windows 95 or later /// /// /// /// This message is similar to ImmGetProperty, except that it uses the current input locale. The application should call /// EM_ISIME before calling this function. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getimeproperty [MsgParams(typeof(Imm32.IGP), null)] EM_GETIMEPROPERTY = WindowMessage.WM_USER + 244, /// Undocumented EM_GETQUERYRTFOBJ = WindowMessage.WM_USER + 269, /// Undocumented EM_SETQUERYRTFOBJ = WindowMessage.WM_USER + 270, /// /// Gets a pointer to the application-defined AutoCorrectProc function. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Returns a pointer to the application-defined AutoCorrectProc function. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getautocorrectproc [MsgParams(LResultType = typeof(AutoCorrectProc))] EM_GETAUTOCORRECTPROC = WindowMessage.WM_USER + 233, /// /// Defines the current autocorrect callback procedure. /// Parameters /// wParam /// The AutoCorrectProc callback function. /// lParam /// Not used; must be zero /// Returns /// If the operation succeeds, the return value is zero. If the operation fails, the return value is a nonzero value. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setautocorrectproc [MsgParams(typeof(AutoCorrectProc), null)] EM_SETAUTOCORRECTPROC = WindowMessage.WM_USER + 234, /// /// Calls the autocorrect callback function that is stored by the EM_SETAUTOCORRECTPROC message, provided that the text /// preceding the insertion point is a candidate for autocorrection. /// Parameters /// wParam /// /// A character of type WCHAR. If this character is a tab (U+0009), and the character preceding the insertion point isn t a /// tab, then the character preceding the insertion point is treated as part of the autocorrect candidate string instead of as a /// string delimiter; otherwise, wParam has no effect. /// /// lParam /// Not used; must be zero. /// Returns /// The return value is zero if the message succeeds, or nonzero if an error occurs. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-callautocorrectproc [MsgParams(typeof(char), null)] EM_CALLAUTOCORRECTPROC = WindowMessage.WM_USER + 255, /// /// Retrieves the table parameters for a table row and the cell parameters for the specified number of cells. /// Parameters /// wParam /// A pointer to a TABLEROWPARMS structure. /// lParam /// A pointer to a TABLECELLPARMS structure. /// Returns /// Returns S_OK if successful, or one of the following error codes. /// /// /// Return code /// Description /// /// /// E_FAIL /// /// Changes cannot be made. This can occur if the control is a plain-text or single-line control, or if the insertion point is inside /// a math object. It also occurs if tables are disabled if the EM_SETEDITSTYLEEX message sets the SES_EX_NOTABLE value. /// /// /// /// E_INVALIDARG /// /// The wParam or lParam is NULL or points to an invalid structure. The cbRow member of the TABLEROWPARMS /// structure must equal /// sizeof(TABLEROWPARMS) /// or sizeof(TABLEROWPARMS) 2*sizeof(long). The latter value is the size of the RichEdit 4.1 TABLEROWPARMS structure. The /// cbCell member of the TABLEROWPARMS structure must equal /// sizeof(TABLECELLPARMS) /// . The query character position must be at a table row delimiter. /// /// /// /// E_OUTOFMEMORY /// Insufficient memory is available. /// /// /// /// /// /// This message gets the table parameters for the row at the character position specified by the cpStartRow member of the /// TABLEROWPARMS structure, and the number of cells specified by the cCells member of the TABLECELLPARMS structure. /// /// /// The character position specified by the cpStartRow member of the TABLEROWPARMS structure should be at the start of /// the table row, or at the end delimiter of the table row. If cpStartRow is set to 1, the character position is given by the /// current selection. In this case, position the selection at the end of the row (between the cell mark and the end delimiter of the /// table row), or select the row. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettableparms [MsgParams(typeof(TABLEROWPARMS?), typeof(TABLECELLPARMS?), LResultType = typeof(HRESULT))] EM_GETTABLEPARMS = WindowMessage.WM_USER + 265, /// /// Sets the current extended edit style flags. /// Parameters /// wParam /// Specifies one or more extended edit style flags. For a list of possible values, see EM_GETEDITSTYLEEX. /// lParam /// /// A mask consisting of one or more of the wParam values. Only the values specified in this mask will be set or cleared. This allows /// a single flag to be set or cleared without reading the current flag states. /// /// Returns /// /// The return value is the state of the extended edit style flags after rich edit has attempted to implement your edit style /// changes. The edit style flags are a set of flags that indicate the current edit style. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-seteditstyleex [MsgParams(typeof(SES_EX), typeof(SES_EX), LResultType = typeof(SES_EX))] EM_SETEDITSTYLEEX = WindowMessage.WM_USER + 275, /// /// Retrieves the current extended edit style flags. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// Returns the extended edit style flags, which can include one or more of the following values. /// /// /// Return code /// Description /// /// /// SES_EX_HANDLEFRIENDLYURL /// /// Display friendly name links with the same text color and underlining as automatic links, provided that temporary formatting isn t /// used or uses text autocolor (default: 0). /// /// /// /// SES_EX_MULTITOUCH /// /// Enable touch support in Rich Edit. This includes selection, caret placement, and context-menu invocation. When this flag is not /// set, touch is emulated by mouse commands, which do not take touch-mode specifics into account (default: 0). /// /// /// /// SES_EX_NOACETATESELECTION /// /// Display selected text using classic Windows selection text and background colors instead of background acetate color (default: 0). /// /// /// /// SES_EX_NOMATH /// /// Disable insertion of math zones (default: 1). To enable math editing and display, send the EM_SETEDITSTYLEEX message with /// wParam set to 0, and lParam set to SES_EX_NOMATH. /// /// /// /// SES_EX_NOTABLE /// /// Disable insertion of tables. The EM_INSERTTABLE message returns E_FAIL and RTF tables are skipped (default: 0). /// /// /// /// SES_EX_USESINGLELINE /// /// Enable a multiline control to act like a single-line control with the ability to scroll vertically when the single-line height is /// greater than the window height (default: 0). /// /// /// /// SES_HIDETEMPFORMAT /// /// Hide temporary formatting that is created when ITextFont.Reset is called with tomApplyTmp. For example, such /// formatting is used by spell checkers to display a squiggly underline under possibly misspelled words. /// /// /// /// SES_EX_USEMOUSEWPARAM /// Use wParam when handling the WM_MOUSEMOVE message and do not call GetAsyncKeyState. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-geteditstyleex [MsgParams(LResultType = typeof(SES_EX))] EM_GETEDITSTYLEEX = WindowMessage.WM_USER + 276, /// /// Gets the story type. /// Parameters /// wParam /// The story index. /// lParam /// Reserved; must be 0. /// Returns /// Returns the story type, which can be a client-defined custom value, or one of the following values: /// /// tomCommentsStory /// tomEndnotesStory /// tomEvenPagesFooterStory /// tomEvenPagesHeaderStory /// tomFindStory /// tomFirstPageFooterStory /// tomFirstPageHeaderStory /// tomFootnotesStory /// tomMainTextStory /// tomPrimaryFooterStory /// tomPrimaryHeaderStory /// tomReplaceStory /// tomScratchStory /// tomTextFrameStory /// tomUnknownStory /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getstorytype [MsgParams(typeof(int), null, LResultType = typeof(int))] EM_GETSTORYTYPE = WindowMessage.WM_USER + 290, /// /// Sets the story type. /// Parameters /// wParam /// The story index. /// lParam /// The new story type. For a list of story types, see EM_GETSTORYTYPE. /// Returns /// The story type that was set. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setstorytype [MsgParams(typeof(int), typeof(int), LResultType = typeof(int))] EM_SETSTORYTYPE = WindowMessage.WM_USER + 291, /// /// Retrieves the current ellipsis mode. When enabled, an ellipsis ( ) is displayed for text that doesn t fit in the display window. /// The ellipsis is only used when the control is not active. When active, scroll bars are used to reveal text that doesn t fit into /// the display window. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Pointer to a DWORD which receives one of the following values. /// /// /// Value /// Meaning /// /// /// ELLIPSIS_NONE /// No ellipsis is used. /// /// /// ELLIPSIS_END /// Ellipsis at the end (forced break). /// /// /// ELLIPSIS_WORD /// Ellipsis at the end (word break). /// /// /// Returns /// If wparam is 0 and lparam is not NULL, the return value equals TRUE; otherwise, the return value equals FALSE. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getellipsismode [MsgParams(null, typeof(ELLIPSIS?), LResultType = typeof(BOOL))] EM_GETELLIPSISMODE = WindowMessage.WM_USER + 305, /// /// This message sets the current ellipsis mode. When enabled, an ellipsis ( ) is displayed for text that doesn t fit in the display /// window. The ellipsis is only used when the control isn t active. When active, scroll bars are used to reveal text that doesn t /// fit into the display window. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// A DWORD which receives one of the following values. /// /// /// Value /// Meaning /// /// /// ELLIPSIS_NONE /// No ellipsis is used. /// /// /// ELLIPSIS_END /// Ellipsis at the end (forced break). /// /// /// ELLIPSIS_WORD /// Ellipsis at the end (word break). /// /// /// The bits for these values all fit in the ELLIPSIS_MASK. /// Returns /// /// If wparam is 0 and lparam is one of the values in the table above, the return value equals TRUE; otherwise, the return value /// equals FALSE. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setellipsismode [MsgParams(null, typeof(ELLIPSIS), LResultType = typeof(BOOL))] EM_SETELLIPSISMODE = WindowMessage.WM_USER + 306, /// /// Changes the parameters of rows in a table. /// Parameters /// wParam /// A pointer to a TABLEROWPARMS structure. /// lParam /// A pointer to a TABLECELLPARMS structure. /// Returns /// Returns S_OK if successful, or one of the following error codes. /// /// /// Return code /// Description /// /// /// E_FAIL /// /// Changes cannot be made. This can occur if the control is a plain-text or single-line control, or if the insertion point is inside /// a math object. It also occurs if tables are disabled, or if the EM_SETEDITSTYLEEX message sets the SES_EX_NOTABLE value. /// /// /// /// E_INVALIDARG /// /// The wParam or lParam is NULL or points to an invalid structure. The cCell member of the TABLEROWPARMS /// structure must be at least 1 and not more than 63. The cbRow member must equal /// sizeof(TABLEROWPARMS) /// or /// sizeof(TABLEROWPARMS) 2*sizeof(long) /// . The latter value is the size of the RichEdit 4.1 TABLEROWPARMS structure. The cbCell member of /// TABLEROWPARMS must equal /// sizeof(TABLECELLPARMS) /// . The insertion point must be at the start of a table or inside a table row, and the number of cells can only change by one. /// /// /// /// E_OUTOFMEMORY /// Insufficient memory is available. /// /// /// /// /// This message changes the parameters of the number of rows specified by the cRow member of the TABLEROWPARMS /// structure, if the table has that many consecutive rows. If cRow is less than 0, the message iterates until the end of the /// table. If the new cell count differs from the current cell count by +1 or 1, it inserts or deletes the cell at the index /// specified by the iCell member of TABLEROWPARMS. The starting table row is identified by a character position. This /// position is specified by cpStartRow members with values that are greater than or equal to zero. The position should be /// inside the table row, but not inside a nested table, unless you want to change that table s parameters. If the cpStartRow /// member is 1, the character position is given by the current selection. For this, position the selection anywhere inside the table /// row, or select the row with the active end of the selection at the end of the table row. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settableparms [MsgParams(typeof(TABLEROWPARMS?), typeof(TABLECELLPARMS?), LResultType = typeof(HRESULT))] EM_SETTABLEPARMS = WindowMessage.WM_USER + 307, /// /// Retrieves the touch options that are associated with a rich edit control. /// Parameters /// wParam /// The touch options to retrieve. It can be one of the following values. /// /// /// Value /// Meaning /// /// /// RTO_SHOWHANDLES /// Retrieves whether the touch grippers are visible. /// /// /// RTO_DISABLEHANDLES /// Retrieving this flag is not implemented. /// /// /// lParam /// Not used; must be zero. /// Returns /// /// Returns the value of the option specified by the wParam parameter. It is nonzero if wParam is RTO_SHOWHANDLES and the /// touch grippers are visible; zero, otherwise. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-gettouchoptions [MsgParams(typeof(RTO), null)] EM_GETTOUCHOPTIONS = WindowMessage.WM_USER + 310, /// /// Sets the touch options associated with a rich edit control. /// Parameters /// wParam /// The touch option to set. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// RTO_SHOWHANDLES /// Show or hide the touch gripper handles, depending on the value of lParam. /// /// /// RTO_DISABLEHANDLES /// /// Enable or disable the touch gripper handles, depending on the value of lParam. When handles are disabled, they are hidden /// if they are visible and remain hidden until an EM_SETTOUCHOPTIONS message changes their status. /// /// /// /// lParam /// Set to TRUE to show/enable the touch selection handles, or FALSE to hide/disable the touch selection handles. /// Returns /// This message returns zero. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-settouchoptions [MsgParams(typeof(RTO), typeof(BOOL))] EM_SETTOUCHOPTIONS = WindowMessage.WM_USER + 311, /// /// Replaces the selection with a blob that displays an image. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// A pointer to a RICHEDIT_IMAGE_PARAMETERS structure that contains the image blob. /// Returns /// Returns S_OK if successful, or one of the following error codes. /// /// /// Return code /// Description /// /// /// E_FAIL /// Cannot insert the image. /// /// /// E_INVALIDARG /// The lParam parameter is NULL or points to an invalid image. /// /// /// E_OUTOFMEMORY /// Insufficient memory is available. /// /// /// /// If the selection is an insertion point, the image blob is inserted at the insertion point. // https://learn.microsoft.com/en-us/windows/win32/controls/em-insertimage [MsgParams(null, typeof(RICHEDIT_IMAGE_PARAMETERS?), LResultType = typeof(HRESULT))] EM_INSERTIMAGE = WindowMessage.WM_USER + 314, /// /// Sets the name of a rich edit control for UI Automation (UIA). /// Parameters /// wParam /// Not used; must be zero. /// lParam /// A pointer to the null-terminated name string. /// Returns /// TRUE if the name for UIA is successfully set, otherwise FALSE. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-setuianame [MsgParams(null, typeof(IntPtr), LResultType = typeof(BOOL))] EM_SETUIANAME = WindowMessage.WM_USER + 320, /// /// Retrieves the current ellipsis state. /// Parameters /// wParam /// Not used; must be zero. /// lParam /// Not used; must be zero. /// Returns /// The return value is TRUE if an ellipsis is being displayed and FALSE otherwise. /// // https://learn.microsoft.com/en-us/windows/win32/controls/em-getellipsisstate [MsgParams(LResultType = typeof(BOOL))] EM_GETELLIPSISSTATE = WindowMessage.WM_USER + 322, } /// /// Notification codes sent by a rich edit control to its parent window. These are in addition to the standard notification codes. /// // https://learn.microsoft.com/en-us/windows/win32/controls/bumper-rich-edit-control-reference-notifications [PInvokeData("richedit.h")] public enum RichEditNotification { /// /// Notifies a rich edit control's parent window that the paragraph direction has changed to left-to-right. A rich edit control sends /// this notification code in the form of a WM_COMMAND message. /// Parameters /// wParam /// The LOWORD contains the identifier of the rich edit control. The HIWORD specifies the notification code. /// lParam /// Handle to the rich edit control. /// Returns /// This notification code does not return a value. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-alignltr [MsgParams(typeof(uint), typeof(HWND))] EN_ALIGNLTR = 0x0710, /// /// Notifies a rich edit control's parent window that the paragraph direction changed to right-to-left. A rich edit control sends /// this notification code in the form of a WM_COMMAND message. /// Parameters /// wParam /// The LOWORD contains the identifier of the rich edit control. The HIWORD specifies the notification code. /// lParam /// Handle to the rich edit control. /// Returns /// This notification code does not return a value. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-alignrtl [MsgParams(typeof(uint), typeof(HWND))] EN_ALIGNRTL = 0x0711, /// /// Notifies a rich edit control's parent window that a paste occurred with a particular clipboard format. A windowless rich edit /// control sends this notification by using the ITextHost::TxNotify method. /// Parameters /// wParam /// The window ID retrieved by calling the GetWindowLong function with the GWL_ID value. /// lParam /// A pointer to a CLIPBOARDFORMAT structure that contains information about the clipboard format. /// Returns /// The return value is ignored. /// /// /// To receive EN_CLIPFORMAT notification codes, specify ENM_CLIPFORMAT in the mask sent with the EM_SETEVENTMASK message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-clipformat [MsgParams(typeof(int), typeof(CLIPBOARDFORMAT?))] EN_CLIPFORMAT = 0x0712, /// /// Notifies a rich edit control parent window that a SYV_CORRECT gesture occurred, giving the parent window a chance to cancel /// correcting the text. A rich edit control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An ENCORRECTTEXT structure specifying the selection to be corrected. /// Returns /// Return zero to ignore the action. /// Returns a nonzero value to process the action. /// /// /// This notification code is sent only if pen capabilities are available. /// /// To receive EN_CORRECTTEXT notification codes, specify ENM_CORRECTTEXT in the mask sent with the EM_SETEVENTMASK message. /// /// /// Note /// /// The EN_CORRECTTEXT notification code is only supported in rich edit version 1.0. It is not supported in later versions of rich /// edit. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-correcttext [MsgParams(null, typeof(ENCORRECTTEXT?))] EN_CORRECTTEXT = 0x0705, /// /// Notifies a rich edit control's parent window that the drag-and-drop operation has completed. A rich edit control sends this /// notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An NMHDR structure. /// Returns /// This notification code does not return a value. /// /// /// To receive an EN_DRAGDROPDONE notification code, specify the ENM_DRAGDROPDONE flag in the mask sent with the /// EM_SETEVENTMASK message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-dragdropdone [MsgParams(null, typeof(NMHDR?))] EN_DRAGDROPDONE = 0x070c, /// /// Notifies a rich edit control parent window that the user is attempting to drop files into the control. A rich edit control sends /// this notification code in the form of a WM_NOTIFY message when it receives the WM_DROPFILES message. /// Parameters /// lParam /// An ENDROPFILES structure that receives dropped files information. /// Returns /// Return a nonzero value to allow the drop operation. /// Return zero to ignore the drop operation. /// /// /// /// For a rich edit control to receive WM_DROPFILES messages, the parent window must register the control as a drop target by /// using the DragAcceptFiles function. The control does not register itself. /// /// /// To receive EN_DROPFILES notification codes, specify ENM_DROPFILES in the mask sent with the EM_SETEVENTMASK message. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-dropfiles [MsgParams(null, typeof(ENDROPFILES?))] EN_DROPFILES = 0x0703, /// /// Notifies a rich edit control parent window that the user has entered new data or has finished entering data while using IME or /// Text Services Framework. /// Parameters /// lParam /// A ENDCOMPOSITIONNOTIFY structure that receives information about the end composition condition. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-endcomposition [MsgParams(null, typeof(ENDCOMPOSITIONNOTIFY?))] EN_ENDCOMPOSITION = 0x0714, /// /// Notifies a rich edit control's parent that the IME conversion status has changed. This notification code is available only for /// Asian-language versions of the operating system. A rich edit control sends this notification code in the form of a /// WM_COMMAND message. /// Parameters /// wParam /// The LOWORD contains the identifier of the rich edit control. The HIWORD specifies the notification code. /// lParam /// Handle to the rich edit control. /// Returns /// This notification code returns zero. /// /// /// /// To receive EN_IMECHANGE notification codes, specify ENM_IMECHANGE in the mask sent with the EM_SETEVENTMASK message. /// /// /// Note /// /// This notification code is only supported in the Asian version of Rich Edit 1.0. It is not supported in later versions. For /// information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-imechange [MsgParams(typeof(uint), typeof(HWND))] EN_IMECHANGE = 0x0707, /// /// A rich edit control sends EN_LINK notification codes when it receives various messages, for example, when the user clicks the /// mouse or when the mouse pointer is over text that has the CFE_LINK effect. A windowless rich edit control sends this /// notification by using the ITextHost::TxNotify method. The parent window of the control receives this notification code /// through a WM_NOTIFY message. /// Parameters /// wParam /// The window ID retrieved by calling the GetWindowLong function with the GWL_ID value. /// lParam /// /// Pointer to an ENLINK structure. The structure contains an NMHDR structure, information about the notification code, /// and a CHARRANGE structure that indicates the range of characters that have the CFE_LINK effect. /// /// Returns /// Return zero to allow the control to proceed with its normal handling of the message. /// Return a nonzero value to prevent the control from handling the message. /// Windows 8: Return EN_LINK_DO_DEFAULT to direct the rich edit control to perform the default action. /// /// /// /// To receive EN_LINK notification codes when the link has focus, specify the ENM_LINK flag in the mask sent with the /// EM_SETEVENTMASK message. /// /// /// If the link has no focus, to receive EN_LINK notification codes specify the SES_NOFOCUSLINKNOTIFY flag in the mask /// sent with the EM_SETEDITSTYLE message. /// /// /// A rich edit control sends EN_LINK notification codes when it receives the following messages while the mouse pointer is /// over text that has the CFE_LINK effect: /// /// /// /// WM_LBUTTONDBLCLK /// /// /// WM_LBUTTONDOWN /// /// /// WM_LBUTTONUP /// /// /// WM_MOUSEMOVE /// /// /// WM_RBUTTONDBLCLK /// /// /// WM_RBUTTONDOWN /// /// /// WM_RBUTTONUP /// /// /// WM_SETCURSOR /// /// /// /// The CFE_LINK effect typically identifies a range of text that contains an URL. Applications can handle the EN_LINK /// notification code by changing the mouse pointer when it is over the URL, or by starting a browser to view the location identified /// by the URL. /// /// /// If you send the EM_AUTOURLDETECT message to enable automatic URL detection, the rich edit control automatically sets the /// CFE_LINK effect for modified text that it identifies as a URL. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-link [MsgParams(typeof(int), typeof(ENLINK?))] EN_LINK = 0x070b, /// /// Notifies the parent window of a Microsoft Rich Edit control that an unsupported Rich Text Format (RTF) keyword was received. A /// Rich Edit control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// The ENLOWFIRTF structure. /// Returns /// This notification code does not return a value. /// /// /// To receive an EN_LOWFIRTF notification, specify the ENM_LOWFIRTF flag in the mask sent with the EM_SETEVENTMASK message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-lowfirtf [MsgParams(null, typeof(ENLOWFIRTF?))] EN_LOWFIRTF = 0x070f, /// /// Notifies a rich edit control's parent window of a keyboard or mouse event in the control. A rich edit control sends this /// notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// /// A MSGFILTER structure containing information about the keyboard or mouse message. If the parent window modifies this /// structure and returns a nonzero value, the modified message is processed instead of the original one. /// /// Returns /// Return zero if the control should process the keyboard or mouse event. /// Return nonzero if the control should ignore the keyboard or mouse event. /// /// /// /// To receive EN_MSGFILTER notification codes for events, specify one or more of the following flags in the mask sent with the /// EM_SETEVENTMASK message. /// /// /// /// Flag /// Meaning /// /// /// ENM_KEYEVENTS /// To receive notification codes for keyboard events. /// /// /// ENM_MOUSEEVENTS /// To receive notification codes for mouse events. /// /// /// ENM_SCROLLEVENTS /// To receive notification codes for a mouse wheel event. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-msgfilter [MsgParams(null, typeof(MSGFILTER?))] EN_MSGFILTER = 0x0700, /// /// Notifies a rich edit control's parent window when the control reads in objects. A rich edit control sends this notification code /// in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An OBJECTPOSITIONS structure. /// Returns /// Return zero to continue the Read operation. /// Return a nonzero value to stop the Read operation. /// /// /// To receive an EN_OBJECTPOSITIONS notification code, specify the ENM_OBJECTPOSITIONS flag in the mask sent with the /// EM_SETEVENTMASK message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-objectpositions [MsgParams(null, typeof(OBJECTPOSITIONS?))] EN_OBJECTPOSITIONS = 0x070a, /// /// Notifies a rich edit control's parent window that a user action on a Component Object Model (COM) object has failed. A rich edit /// control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An ENOLEOPFAILED structure that contains information about the failure. /// Returns /// This notification code returns zero. /// /// /// The parent window will always get a WM_NOTIFY message for this event, it does not require a notification mask sent with EM_SETEVENTMASK. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-oleopfailed [MsgParams(null, typeof(ENOLEOPFAILED?))] EN_OLEOPFAILED = 0x0709, /// /// Notifies a windowless rich edit control's host window that a change has occurred. A rich edit control sends this notification /// code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// A CHANGENOTIFY structure specifying the change that was made. /// Returns /// This notification code does not return a value. /// /// /// To receive EN_CHANGE notification codes, specify ENM_CHANGE in the mask sent with the EM_SETEVENTMASK message. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-change--rich-edit-control- [MsgParams(null, typeof(CHANGENOTIFY?))] EN_PAGECHANGE = 0x070e, /// /// Notifies a rich edit control's parent that an outline has been expanded. A rich edit control sends this notification code in the /// form of a WM_NOTIFY message. /// Parameters /// lParam /// An NMHDR structure. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-paragraphexpanded [MsgParams(null, typeof(NMHDR?))] EN_PARAGRAPHEXPANDED = 0x070d, /// /// Notifies a rich edit control's parent window that the user is taking an action that would change a protected range of text. A /// rich edit control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An ENPROTECTED structure containing information about the message that triggered the notification code. /// Returns /// Return zero to allow the operation. /// Return a nonzero value to prevent the operation. /// /// /// /// If zero is returned and the msg, wParam, and lParam members of the ENPROTECTED structure are changed, /// the control processes the revised message instead of the original message. /// /// /// To receive EN_PROTECTED notification codes, specify ENM_PROTECTED in the mask sent with the EM_SETEVENTMASK message. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-protected [MsgParams(null, typeof(ENPROTECTED?))] EN_PROTECTED = 0x0704, /// /// Notifies a rich edit control's parent window that the control's contents are either smaller or larger than the control's window /// size. A rich edit control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// A REQRESIZE structure that receives the requested size. /// Returns /// This notification code does not return a value. /// /// /// /// To support the bottomless behavior of a rich edit control, the parent window must resize the control when it receives this /// notification code. /// /// /// To receive EN_REQUESTRESIZE notification codes, specify ENM_REQUESTRESIZE in the mask sent with the EM_SETEVENTMASK message. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-requestresize [MsgParams(null, typeof(REQRESIZE?))] EN_REQUESTRESIZE = 0x0701, /// /// Notifies the rich edit control's parent window that the control is closing and the clipboard contains information. A rich edit /// control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An ENSAVECLIPBOARD structure that contains information about clipboard information. /// Returns /// Return zero if the clipboard should be made available to other applications. /// Return a nonzero value if the clipboard should not be saved. /// /// /// The parent window will always get a WM_NOTIFY message for this event, it does not require a notification mask sent with EM_SETEVENTMASK. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-saveclipboard [MsgParams(null, typeof(ENSAVECLIPBOARD?))] EN_SAVECLIPBOARD = 0x0708, /// /// Notifies a rich edit control's parent window that the current selection has changed. A rich edit control sends this notification /// code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// A SELCHANGE structure that receives information about the selection. /// Returns /// This notification code does not return a value. /// /// /// /// To receive EN_SELCHANGE notification codes, specify ENM_SELCHANGE in the mask sent with the EM_SETEVENTMASK message. /// /// /// This notification code is sent when the caret position changes and no text is selected (the selection is empty). The caret /// position can change when the user clicks the mouse, types, or presses an arrow key. /// /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-selchange [MsgParams(null, typeof(SELCHANGE?))] EN_SELCHANGE = 0x0702, /// Notifies a rich edit control parent window that the user started typing with IME or Text Services Framework. /// Parameters /// lParam /// An NMHDR structure. // https://learn.microsoft.com/en-us/windows/win32/controls/en-startcomposition [MsgParams(null, typeof(NMHDR?))] EN_STARTCOMPOSITION = 0x0713, /// /// Notifies a rich edit control's parent window that an action occurred for which the control cannot allocate enough memory to /// maintain the undo state. A rich edit control sends this notification code in the form of a WM_NOTIFY message. /// Parameters /// lParam /// An NMHDR structure. /// Returns /// Return zero to continue the Undo operation. /// Return a nonzero value to stop the Undo operation. /// /// /// The parent window will always get a WM_NOTIFY message for this event, it does not require a notification mask sent with EM_SETEVENTMASK. /// // https://learn.microsoft.com/en-us/windows/win32/controls/en-stopnoundo [MsgParams(null, typeof(NMHDR?))] EN_STOPNOUNDO = 0x0706, } /// Styles for the rich edit control. [PInvokeData("Winuser.h", MSDNShortId = "edit_control_constants")] [Flags] public enum RichEditStyle : uint { /// Left aligns text. ES_LEFT = 0x0000, /// Centers text in a single-line or multiline edit control. ES_CENTER = 0x0001, /// Right aligns text in a single-line or multiline edit control. ES_RIGHT = 0x0002, /// Designates a multiline edit control. The default is single-line edit control. ES_MULTILINE = 0x0004, /// /// Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls. /// ES_PASSWORD = 0x0020, /// Automatically scrolls text up one page when the user presses the ENTER key on the last line. ES_AUTOVSCROLL = 0x0040, /// /// Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user /// presses the ENTER key, the control scrolls all text back to position zero. /// ES_AUTOHSCROLL = 0x0080, /// /// Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus /// and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, /// even if the control does not have the focus. /// ES_NOHIDESEL = 0x0100, /// Prevents the user from typing or editing text in the edit control. ES_READONLY = 0x0800, /// /// Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit /// control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog /// box's default push button. This style has no effect on a single-line edit control. /// ES_WANTRETURN = 0x1000, /// Allows only digits to be entered into the edit control. ES_NUMBER = 0x2000, /// /// Preserves the selection when the control loses the focus. By default, the entire contents of the control are selected when it /// regains the focus. /// ES_SAVESEL = 0x00008000, /// Displays the control with a sunken border style so that the rich edit control appears recessed into its parent window. ES_SUNKEN = 0x00004000, /// Disables scroll bars instead of hiding them when they are not needed. ES_DISABLENOSCROLL = 0x00002000, /// /// Adds space to the left margin where the cursor changes to a right-up arrow, allowing the user to select full lines of text. /// ES_SELECTIONBAR = 0x01000000, /// Disables support for drag-drop of OLE objects. ES_NOOLEDRAGDROP = 0x00000008, /// /// Prevents the control from calling the OleInitialize function when created. This window style is useful only in dialog templates /// because CreateWindowEx does not accept this style. /// ES_EX_NOCALLOLEINIT = 0x00000000, /// Draws text and objects in a vertical direction. This style is available for Asian-language support only. ES_VERTICAL = 0x00400000, /// Disables the IME operation. This style is available for Asian language support only. ES_NOIME = 0x00080000, /// /// Directs the rich edit control to allow the application to handle all IME operations. This style is available for Asian language /// support only. /// ES_SELFIME = 0x00040000, } /// The touch options to retrieve. [PInvokeData("richedit.h")] public enum RTO { /// Retrieves whether the touch grippers are visible. RTO_SHOWHANDLES = 1, /// Retrieving this flag is not implemented. RTO_DISABLEHANDLES = 2, /// RTO_READINGMODE = 3, } /// EM_SETCHARFORMAT wParam masks [PInvokeData("richedit.h")] [Flags] public enum SCF : ushort { /// /// Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion /// point, and the new character format is in effect only until the insertion point changes. /// SCF_SELECTION = 0x0001, /// /// Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the /// formatting is applied to the word. The SCF_WORD value must be used in conjunction with the SCF_SELECTION value. /// SCF_WORD = 0x0002, /// RichEdit 4.1: Sets the default font for the control. SCF_DEFAULT = 0x0000, /// Applies the formatting to all text in the control. Not valid with SCF_SELECTION or SCF_WORD. SCF_ALL = 0x0004, /// /// RichEdit 4.1: Used with SCF_SELECTION. Indicates that format came from a toolbar or other UI tool, so UI formatting rules should /// be used instead of literal formatting. /// SCF_USEUIRULES = 0x0008, /// /// RichEdit 4.1: Associates a font to a given script, thus changing the default font for that script. To specify the font, use the /// following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. /// SCF_ASSOCIATEFONT = 0x0010, /// /// RichEdit 4.1: Prevents keyboard switching to match the font. For example, if an Arabic font is set, normally the automatic /// keyboard feature for Bidi languages changes the keyboard to an Arabic keyboard. /// SCF_NOKBUPDATE = 0x0020, /// /// RichEdit 4.1: Associates a surrogate (plane-2) font to a given script, thus changing the default font for that script. To specify /// the font, use the following members of CHARFORMAT2: yHeight, bCharSet, bPitchAndFamily, szFaceName, and lcid. /// SCF_ASSOCIATEFONT2 = 0x0040, /// Apply the font only if it can handle script. SCF_SMARTFONT = 0x0080, /// Gets the character repertoire from the LCID. SCF_CHARREPFROMLCID = 0x0100, /// Prevents setting the default paragraph format when the rich edit control is empty. SPF_DONTSETDEFAULT = 0x0002, /// Sets the default paragraph formatting attributes. SPF_SETDEFAULT = 0x0004, } /// Value specifying the contents of the new selection. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._encorrecttext")] [Flags] public enum SEL : ushort { /// No selection. SEL_EMPTY = 0x0000, /// The new selection contains text. SEL_TEXT = 0x0001, /// The new selection contains at least one COM object. SEL_OBJECT = 0x0002, /// The new selection contains more than one character of text. SEL_MULTICHAR = 0x0004, /// The new selection contains more than one COM object. SEL_MULTIOBJECT = 0x0008, } /// Edit style flags. [Flags] public enum SES : uint { /// Undocumented SES_ALLOWBEEPS = 256, /// Rich Edit will call the system beeper if the user attempts to enter more than the maximum characters. SES_BEEPONMAXTEXT = 2, /// /// Turns on bidirectional processing. This is automatically turned on by Rich Edit if any of the following window styles are active: /// WS_EX_RIGHT, WS_EX_RTLREADING, WS_EX_LEFTSCROLLBAR. However, this setting is useful for handling these window styles when using a /// custom implementation of ITextHost (default: 0). /// SES_BIDI = 4096, /// Windows XP with SP1: Allow embedded objects to be inserted using TSF (default: 0). SES_CTFALLOWEMBED = 0x00200000, /// Windows XP with SP1: Allows TSF proofing tips (default: 0). SES_CTFALLOWPROOFING = 0x00800000, /// Windows XP with SP1: Allows TSF SmartTag tips (default: 0). SES_CTFALLOWSMARTTAG = 0x00400000, /// Windows 8: Do not allow the TSF lock read/write access. This pauses TSF input. SES_CTFNOLOCK = 0x10000000, /// Undocumented SES_CUSTOMLOOK = 0x00080000, /// /// Windows 8: Fonts with an fi ligature are displayed with default OpenType features resulting in improved typography (default: 0). /// SES_DEFAULTLATINLIGA = 16, /// /// Windows XP with SP1: Use draft mode fonts to display text. Draft mode is an accessibility option where the control displays the /// text with a single font; the font is determined by the system setting for the font used in message boxes. For example, accessible /// users may read text easier if it is uniform, rather than a mix of fonts and styles (default: 0). /// SES_DRAFTMODE = 32786, /// /// Windows 8: Emulate RichEdit 1.0 behavior. /// /// If you really want this behavior, use the Windows riched32.dll instead of riched20.dll or msftedit.dll. /// Riched32.dll had more functionality. /// /// SES_EMULATE10 = 16, /// When this bit is on, rich edit attempts to emulate the system edit control (default: 0). SES_EMULATESYSEDIT = 1, /// Extends the background color all the way to the edges of the client rectangle (default: 0). SES_EXTENDBACKCOLOR = 4, /// /// Windows XP with SP1: If the width of table gridlines is zero, gridlines are not displayed. This is equivalent to the hide /// gridlines feature in Word's table menu (default: 0). /// SES_HIDEGRIDLINES = 0x00020000, /// Windows 8: When the cursor is over a link, display a tooltip with the target link address (default: 0). SES_HYPERLINKTOOLTIPS = 8, /// Undocumented SES_LBSCROLLNOTIFY = 0x00100000, /// /// Windows 8: Provide logical caret information instead of a caret bitmap as described in ITextHost::TxSetCaretPos (default: 0). /// SES_LOGICALCARET = 0x01000000, /// Converts all input characters to lowercase (default: 0). SES_LOWERCASE = 1024, /// Obsolete. Do not use. SES_MAPCPS = 8, /// Windows 8: Enable multiselection with individual mouse selections made while the Ctrl key is pressed (default: 0). SES_MULTISELECT = 0x08000000, /// Windows 8: Do not adjust line height for East Asian text (default: 0 which adjusts the line height by 15%). SES_NOEALINEHEIGHTADJUST = 0x20000000, /// Sends EN_LINK notification from links that do not have focus. SES_NOFOCUSLINKNOTIFY = 32, /// Disallows IMEs for this instance of the rich edit control (default: 0). SES_NOIME = 128, /// /// When this bit is on, rich edit does not verify the sequence of typed text. Some languages (such as Thai and Vietnamese) require /// verifying the input sequence order before submitting it to the backing store (default: 0). /// SES_NOINPUTSEQUENCECHK = 2048, /// When KillFocus occurs, scroll to the beginning of the text (character position equal to 0) (default: 0). SES_SCROLLONKILLFOCUS = 8192, /// Windows 8: Add or delete a space according to the context when dropping text (default: 0). SES_SMARTDRAGDROP = 0x04000000, /// Obsolete. Do not use. SES_USECRLF = 32, /// Windows 8: If word select is active, ensure that the drop location is at a word boundary (default: 0). SES_WORDDRAGDROP = 0x02000000, /// Converts all input characters to uppercase (default: 0). SES_UPPERCASE = 512, /// Uses the Active IMM input method component that ships with Internet Explorer 4.0 or later (default: 0). SES_USEAIMM = 64, /// /// Windows XP with SP1: Uses an @ font, which is designed for vertical text; this is used with the ES_VERTICAL window style. The /// name of an @ font begins with the @ symbol, for example, "@Batang" (default: 0, but is automatically turned on for vertical text layout). /// SES_USEATFONT = 0x00040000, /// Windows XP with SP1: Turns on TSF support. (default: 0) SES_USECTF = 0x00010000, /// /// Turns on translation of CRCRLFs to CRs. When this bit is on and a file is read in, all instances of CRCRLF will be converted to /// hard CRs internally. This will affect the text wrapping. Note that if such a file is saved as plain text, the CRs will be /// replaced by CRLFs. This is the .txt standard for plain text (default: 0, which deletes CRCRLFs on input). /// SES_XLTCRCRLFTOCR = 16384, } /// The extended edit style flags. [PInvokeData("richedit.h")] [Flags] public enum SES_EX : uint { /// /// Display friendly name links with the same text color and underlining as automatic links, provided that temporary formatting isn t /// used or uses text autocolor (default: 0). /// SES_EX_HANDLEFRIENDLYURL = 0x00000100, /// /// Enable touch support in Rich Edit. This includes selection, caret placement, and context-menu invocation. When this flag is not /// set, touch is emulated by mouse commands, which do not take touch-mode specifics into account (default: 0). /// SES_EX_MULTITOUCH = 0x08000000, /// /// Display selected text using classic Windows selection text and background colors instead of background acetate color (default: 0). /// SES_EX_NOACETATESELECTION = 0x00100000, /// /// Disable insertion of math zones (default: 1). To enable math editing and display, send the EM_SETEDITSTYLEEX message with wParam /// set to 0, and lParam set to SES_EX_NOMATH. /// SES_EX_NOMATH = 0x00000040, /// Disable insertion of tables. The EM_INSERTTABLE message returns E_FAIL and RTF tables are skipped (default: 0). SES_EX_NOTABLE = 0x00000004, /// /// Enable a multiline control to act like a single-line control with the ability to scroll vertically when the single-line height is /// greater than the window height (default: 0). /// SES_EX_USESINGLELINE = 0x00200000, /// /// Hide temporary formatting that is created when ITextFont.Reset is called with tomApplyTmp. For example, such formatting is used /// by spell checkers to display a squiggly underline under possibly misspelled words. /// SES_HIDETEMPFORMAT = 0x10000000, /// Use wParam when handling the WM_MOUSEMOVE message and do not call GetAsyncKeyState. SES_EX_USEMOUSEWPARAM = 0x20000000, /// Undocumented SES_EX_NOTHEMING = 0x00080000, } /// Specifies the data format and replacement options. [PInvokeData("richedit.h")] [Flags] public enum SF : ushort { /// Text with spaces in place of COM objects. SF_TEXT = 0x0001, /// RTF SF_RTF = 0x0002, /// RTF with spaces in place of COM objects. SF_RTFNOOBJS = 0x0003, /// Text with a text representation of COM objects. SF_TEXTIZED = 0x0004, /// Microsoft Rich Edit 2.0 and later: Indicates Unicode text. You can combine this flag with the SF_TEXT flag. SF_UNICODE = 0x0010, /// /// Rich Edit 3.0 and later: Generates UTF-8 RTF as well as text using other code pages. The code page is set in the high word of /// wParam. For example, for UTF-8 RTF, set wParam to (CP_UTF8 << 16) | SF_USECODEPAGE | SF_RTF. /// SF_USECODEPAGE = 0x0020, /// Output \uN for nonASCII SF_NCRFORNONASCII = 0x40, /// Output \par at end SFF_WRITEXTRAPAR = 0x80, /// /// If specified, the data stream replaces the contents of the current selection. If not specified, the data stream replaces the /// entire contents of the control. You can combine this flag with the SF_TEXT or SF_RTF flags. /// SFF_SELECTION = 0x8000, /// /// If specified, only keywords common to all languages are streamed in. Language-specific RTF keywords in the stream are ignored. If /// not specified, all keywords are streamed in. You can combine this flag with the SF_RTF flag. /// SFF_PLAINRTF = 0x4000, /// Flag telling file stream output (SFF_SELECTION flag not set) to persist \viewscaleN control word. SFF_PERSISTVIEWSCALE = 0x2000, /// Flag telling file stream input with SFF_SELECTION flag not set not to close the document SFF_KEEPDOCINFO = 0x1000, /// Flag telling stream operations to output in Pocket Word format. SFF_PWD = 0x0800, /// 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN. SF_RTFVAL = 0x0700, } /// Option flags for SETTEXTEX. [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._settextex")] [Flags] public enum ST : uint { /// Deletes the undo stack, discards rich-text formatting, replaces all text. ST_DEFAULT = 0, /// Keeps the undo stack. ST_KEEPUNDO = 1, /// Replaces selection and keeps rich-text formatting. ST_SELECTION = 2, /// Act as if new characters are being entered. ST_NEWCHARS = 4, /// The text is UTF-16 (the WCHAR data type). ST_UNICODE = 8, } /// Indicates the text mode of a rich edit control. The EM_SETTEXTMODE and EM_GETTEXTMODE messages use this enumeration type. // https://learn.microsoft.com/en-us/windows/win32/api/Richedit/ne-richedit-textmode typedef enum tagTextMode { TM_PLAINTEXT = 1, // TM_RICHTEXT = 2, TM_SINGLELEVELUNDO = 4, TM_MULTILEVELUNDO = 8, TM_SINGLECODEPAGE = 16, TM_MULTICODEPAGE = 32 } TEXTMODE; [PInvokeData("richedit.h", MSDNShortId = "NE:richedit.tagTextMode")] [Flags] public enum TEXTMODE { /// /// Value: /// 1 /// /// Indicates plain-text mode, in which the control is similar to a standard edit control. For more information about plain-text /// mode, see the Remarks section of /// /// EM_SETTEXTMODE /// . /// TM_PLAINTEXT = 1, /// /// Value: /// 2 /// /// Indicates rich-text mode, in which the control has the standard rich edit functionality. Rich-text mode is the default setting. /// /// TM_RICHTEXT = 2, /// /// Value: /// 4 /// The control allows the user to undo only the last action in the undo queue. /// TM_SINGLELEVELUNDO = 4, /// /// Value: /// 8 /// The control supports multiple undo actions. This is the default setting. Use the /// EM_SETUNDOLIMIT /// message to set the maximum number of undo actions. /// TM_MULTILEVELUNDO = 8, /// /// Value: /// 16 /// /// The control only allows the English keyboard and a keyboard corresponding to the default character set. For example, you could /// have Greek and English. Note that this prevents Unicode text from entering the control. For example, use this value if a Rich /// Edit control must be restricted to ANSI text. /// /// TM_SINGLECODEPAGE = 16, /// /// Value: /// 32 /// The control allows multiple code pages and Unicode text into the control. This is the default setting. /// TM_MULTICODEPAGE = 32, } /// A mask identifying the options to set. [PInvokeData("richedit.h")] [Flags] public enum TO : uint { /// Advanced line breaking and line formatting is turned on. TO_ADVANCEDTYPOGRAPHY = 0x0001, /// Faster line breaking for simple text (requires TO_ADVANCEDTYPOGRAPHY). TO_SIMPLELINEBREAK = 0x0002, /// TO_DISABLECUSTOMTEXTOUT = 0x0004, /// TO_ADVANCEDLAYOUT = 0x0008, } /// /// Contains values that indicate types of rich edit control actions that can be undone or redone. The EM_GETREDONAME and EM_GETUNDONAME /// messages use this enumeration type to return a value. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ne-richedit-undonameid typedef enum _undonameid { UID_UNKNOWN = 0, // UID_TYPING = 1, UID_DELETE = 2, UID_DRAGDROP = 3, UID_CUT = 4, UID_PASTE = 5, UID_AUTOTABLE = 6 } UNDONAMEID; [PInvokeData("richedit.h", MSDNShortId = "NE:richedit._undonameid")] public enum UNDONAMEID { /// /// Value: /// 0 /// The type of undo action is unknown. /// UID_UNKNOWN = 0, /// /// Value: /// 1 /// Typing operation. /// UID_TYPING, /// /// Value: /// 2 /// Delete operation. /// UID_DELETE, /// /// Value: /// 3 /// Drag-and-drop operation. /// UID_DRAGDROP, /// /// Value: /// 4 /// Cut operation. /// UID_CUT, /// /// Value: /// 5 /// Paste operation. /// UID_PASTE, /// /// Value: /// 6 /// Automatic table insertion; for example, typing +---+---+<Enter> to insert a table row. /// UID_AUTOTABLE, } /// The word-wrapping and word-breaking options for a rich edit control. [PInvokeData("richedit.h")] [Flags] public enum WBF : uint { /// Enables Asian-specific word wrap operations, such as kinsoku in Japanese. WBF_WORDWRAP = 0x010, /// Enables English word-breaking operations in Japanese and Chinese. Enables Hangeul word-breaking operation. WBF_WORDBREAK = 0x020, /// Recognizes overflow punctuation. (Not currently supported.) WBF_OVERFLOW = 0x040, /// Sets the Level 1 punctuation table as the default. WBF_LEVEL1 = 0x080, /// Sets the Level 2 punctuation table as the default. WBF_LEVEL2 = 0x100, /// Sets the application-defined punctuation table. WBF_CUSTOM = 0x200, } /// Initializes the current thread to use the Rich Edit control. public static void MsftEditThreadInit() { Ole32.OleInitialize(IntPtr.Zero); Kernel32.LoadLibrary(Lib_msftedit); } /// /// [Intended for internal use; not recommended for use in applications. This function may not be supported in future versions.] /// Registers two class names, REListBox20W and RECombobox20W, that could be used to create Rich Edit listbox or combobox windows. /// /// Returns TRUE if successful, or FALSE otherwise. // https://learn.microsoft.com/en-us/windows/win32/controls/reextendedregisterclass BOOL WINAPI REExtendedRegisterClass(void); [PInvokeData("None")] [DllImport(Lib_Riched20, SetLastError = false, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool REExtendedRegisterClass(); /// Retrives a related instance from a Rich Edit control by sending a EM_GETOLEINTERFACE message. /// The rich edit control window handle. /// The instance. public static IRichEditOle RichEdit_GetOleInterface(HWND hRichEditWnd) { IntPtr ptr = IntPtr.Zero; if (IntPtr.Zero == SendMessage(hRichEditWnd, RichEditMessage.EM_GETOLEINTERFACE, default, ref ptr)) Win32Error.ThrowLastError(); return (IRichEditOle)Marshal.GetObjectForIUnknown(ptr); } /// /// Contains bidirectional information about a rich edit control. This structure is used by the EM_GETBIDIOPTIONS and EM_SETBIDIOPTIONS /// messages to get and set the bidirectional information for a control. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-bidioptions typedef struct _bidioptions { UINT cbSize; WORD // wMask; WORD wEffects; } BIDIOPTIONS; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._bidioptions")] [StructLayout(LayoutKind.Sequential)] public struct BIDIOPTIONS { /// /// Type: UINT /// /// Specifies the size, in bytes, of the structure. Before passing this structure to a rich edit control, set cbSize to the /// size of the BIDIOPTIONS structure. The rich edit control checks the size of cbSize before sending an /// EM_GETBIDIOPTIONS message. /// /// public uint cbSize; /// /// Type: WORD /// /// A set of mask bits that determine which of the wEffects flags will be set to 1 or 0 by the rich edit control. This /// approach eliminates the need to read the effects flags before changing them. /// /// Obsolete bits are valid only for the bidirectional version of Rich Edit 1.0. /// /// /// Value /// Meaning /// /// /// BOM_CONTEXTALIGNMENT /// The BOE_CONTEXTALIGNMENT value is valid. /// /// /// BOM_CONTEXTREADING /// The BOE_CONTEXTREADING value is valid. /// /// /// BOM_DEFPARADIR /// The BOE_RTLDIR value is valid. /// /// /// BOM_LEGACYBIDICLASS /// The BOE_LEGACYBIDICLASS value is valid. /// /// /// BOM_NEUTRALOVERRIDE /// The BOE_NEUTRALOVERRIDE value is valid. /// /// /// BOM_PLAINTEXT /// The BOE_PLAINTEXT value is valid. (obsolete). /// /// /// BOM_UNICODEBIDI /// The BOE_UNICODEBIDI value is valid. /// /// /// public BOM wMask; /// /// Type: WORD /// /// A set of flags that indicate the desired or current state of the effects flags. Obsolete bits are valid only for the /// bidirectional version of Rich Edit 1.0. /// /// Obsolete bits are valid only for the bidirectional version of Rich Edit 1.0. /// /// /// Value /// Meaning /// /// /// BOE_CONTEXTALIGNMENT /// /// If this flag is 1, context paragraph alignment is active. This feature is used only for plain-text controls. When active, the /// paragraph alignment is set to PFA_LEFT if the first strongly directional character is LTR, or PFA_RIGHT if the first strongly /// directional character is RTL. If the control has no strongly directional character, the alignment is chosen according to the /// directionality of the keyboard language when the control regains focus (default: 0). /// /// /// /// BOE_CONTEXTREADING /// /// If this flag is 1, context paragraph directionality is active. This feature is used only for plain-text controls. When active, /// the paragraph directionality effect PFE_RTLPARA is set to 0 if the first strongly directional character is LTR, or 1 if the first /// strongly directional character is RTL. If the control has no strongly directional character, the directionality is chosen /// according to the directionality of the keyboard language when the control regains focus (default: 0). /// /// /// /// BOE_FORCERECALC /// /// Windows 8: Force the rich edit control to recalculate the bidirectional information, and then redraw the control. /// /// /// /// BOE_LEGACYBIDICLASS /// /// Causes the plus and minus characters to be treated as neutral characters with no implied direction. Also causes the slash /// character to be treated as a common separator. /// /// /// /// BOE_NEUTRALOVERRIDE /// /// If this flag is 1, the characters !"#&'()*+,-./:;<=> are treated as strong LTR characters (default: 0). /// /// /// /// BOE_PLAINTEXT /// Uses plain text layout (obsolete). /// /// /// BOE_RTLDIR /// Default paragraph direction—implies alignment (obsolete). /// /// /// BOE_UNICODEBIDI /// /// If this flag is 1, the Unicode Bidi Algorithm (UBA) is used for rich-text controls. The UBA is always used for plain-text /// controls (default: 0). /// /// /// /// public BOE wEffects; } /// /// Contains information about character formatting in a rich edit control. /// /// Rich Edit 2.0: The CHARFORMAT2 structure is a Microsoft Rich Edit 2.0 extension of the CHARFORMAT structure. Microsoft /// Rich Edit 2.0 and later allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages. /// /// /// /// /// To turn off a formatting attribute, set the appropriate value in dwMask but do not set the corresponding value in /// dwEffects. For example, to turn off italics, set CFM_ITALIC but do not set CFE_ITALIC. /// /// /// Note /// /// The richedit.h header defines CHARFORMAT as an alias which automatically selects the ANSI or Unicode version of this function based /// on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not /// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for /// Function Prototypes. /// /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-charformata typedef struct _charformat { UINT cbSize; DWORD // dwMask; DWORD dwEffects; LONG yHeight; LONG yOffset; COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; char // szFaceName[LF_FACESIZE]; } CHARFORMATA; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._charformat")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CHARFORMAT { /// /// Type: UINT /// Size in bytes of the specified structure. This member must be set before passing the structure to the rich edit control. /// public uint cbSize; /// /// Type: DWORD /// /// Members containing valid information or attributes to set. This member can be zero, one, or more than one of the following values. /// /// /// /// Value /// Meaning /// /// /// CFM_ALL /// /// Windows 8: A combination of the following values: CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET /// /// /// /// CFM_BOLD /// The CFE_BOLD value of the dwEffects member is valid. /// /// /// CFM_CHARSET /// The bCharSet member is valid. /// /// /// CFM_COLOR /// The crTextColor member and the CFE_AUTOCOLOR value of the dwEffects member are valid. /// /// /// CFM_EFFECTS /// /// Windows 8: A combination of the following values: CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | CFM_STRIKEOUT | /// CFE_PROTECTED | CFM_LINK /// /// /// /// CFM_FACE /// The szFaceName member is valid. /// /// /// CFM_ITALIC /// The CFE_ITALIC value of the dwEffects member is valid. /// /// /// CFM_OFFSET /// The yOffset member is valid. /// /// /// CFM_PROTECTED /// The CFE_PROTECTED value of the dwEffects member is valid. /// /// /// CFM_SIZE /// The yHeight member is valid. /// /// /// CFM_STRIKEOUT /// The CFE_STRIKEOUT value of the dwEffects member is valid. /// /// /// CFM_UNDERLINE. /// The CFE_UNDERLINE value of the dwEffects member is valid. /// /// /// public CFM dwMask; /// /// Type: DWORD /// Character effects. This member can be a combination of the following values. /// /// /// Value /// Meaning /// /// /// CFE_AUTOCOLOR /// The text color is the return value of GetSysColor(COLOR_WINDOWTEXT). /// /// /// CFE_BOLD /// Characters are bold. /// /// /// CFE_DISABLED /// /// RichEdit 2.0 and later: Characters are displayed with a shadow that is offset by 3/4 point or one pixel, whichever is larger. /// /// /// /// CFE_ITALIC /// Characters are italic. /// /// /// CFE_STRIKEOUT /// Characters are struck. /// /// /// CFE_UNDERLINE /// Characters are underlined. /// /// /// CFE_PROTECTED /// Characters are protected; an attempt to modify them will cause an EN_PROTECTED notification code. /// /// /// public CFE dwEffects; /// /// Type: LONG /// Character height, in twips (1/1440 of an inch or 1/20 of a printer's point). /// public int yHeight; /// /// Type: LONG /// /// Character offset, in twips, from the baseline. If the value of this member is positive, the character is a superscript; if it is /// negative, the character is a subscript. /// /// public int yOffset; /// /// Type: COLORREF /// /// Text color. This member is ignored if the CFE_AUTOCOLOR character effect is specified. To generate a COLORREF, use the RGB macro. /// /// public COLORREF crTextColor; /// /// Type: BYTE /// /// Character set value. The bCharSet member can be one of the values specified for the lfCharSet member of the LOGFONT /// structure. Microsoft Rich Edit 3.0 may override this value if it is invalid for the target characters. /// /// public CharacterSet bCharSet; /// /// Type: BYTE /// Font family and pitch. This member is the same as the lfPitchAndFamily member of the structure. /// public FontPitch bPitchAndFamily; /// /// Type: TCHAR[LF_FACESIZE] /// Null-terminated character array specifying the font name. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szFaceName; } /// /// Contains information about character formatting in a rich edit control. CHARFORMAT2 is a Microsoft Rich Edit 2.0 extension of /// the CHARFORMAT structure. Microsoft Rich Edit 2.0 allows you to use either structure with the EM_GETCHARFORMAT and EM_SETCHARFORMAT messages. /// /// /// To turn off a formatting attribute, set the appropriate value in dwMask but do not set the corresponding value in /// dwEffects. For example, to turn off italics, set CFM_ITALIC but do not set CFE_ITALIC. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-charformat2w_1 typedef struct _charformat2w { UINT cbSize; // DWORD dwMask; DWORD dwEffects; LONG yHeight; LONG yOffset; COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; WCHAR // szFaceName[LF_FACESIZE]; WORD wWeight; SHORT sSpacing; COLORREF crBackColor; LCID lcid; union { DWORD dwReserved; DWORD dwCookie; }; // DWORD dwReserved; SHORT sStyle; WORD wKerning; BYTE bUnderlineType; BYTE bAnimation; BYTE bRevAuthor; BYTE bUnderlineColor; } CHARFORMAT2W; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._charformat2w")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CHARFORMAT2 { /// /// Type: UINT /// /// Specifies the size, in bytes, of the structure. Before passing this structure to a rich edit control, set cbSize to the /// size of the CHARFORMAT or CHARFORMAT2 structure. If cbSize equals the size of a CHARFORMAT structure, the /// control uses only the CHARFORMAT members. /// /// public uint cbSize; /// /// Type: DWORD /// /// Specifies the parts of the CHARFORMAT2 structure that contain valid information. The dwMask member can be a /// combination of the values from two sets of bit flags. One set indicates the structure members that are valid. Another set /// indicates the valid attributes in the dwEffects member. /// /// Set the following values to indicate the valid attributes of the dwEffects member. /// /// /// Value /// Meaning /// /// /// CFM_ALL /// /// A combination of the following values: CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET /// /// /// /// CFM_ALL2 /// /// A combination of the following values: CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID | /// CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR | CFM_SPACING | CFM_KERNING | CFM_STYLE /// | CFM_ANIMATION | CFM_COOKIE /// /// /// /// CFM_ALLCAPS /// The CFE_ALLCAPS value is valid. /// /// /// CFM_EFFECTS /// /// A combination of the following values: CFM_EFFECTS2 | CFM_FONTBOUND | CFM_EXTENDED | /// CFM_MATHNOBUILDUP | CFM_MATH | CFM_MATHORDINARY /// /// /// /// CFM_BOLD /// The CFE_BOLD value is valid. /// /// /// CFM_COLOR /// The CFE_AUTOCOLOR value is valid, or the crTextColor member is valid. /// /// /// CFM_COOKIE /// The dwCookie value is valid. /// /// /// CFM_DISABLED /// The CFE_DISABLED value is valid. /// /// /// CFM_EXTENDED /// The CFE_EXTENDED value is valid. /// /// /// CFM_EFFECTS /// /// A combination of the following values: CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | /// CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK /// /// /// /// CFM_EFFECTS2 /// /// A combination of the following values: CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS | /// CFM_HIDDEN | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS | CFM_IMPRINT | CFM_REVISED | /// CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR /// /// /// /// CFM_EMBOSS /// The CFE_EMBOSS value is valid. /// /// /// CFM_FONTBOUND /// The CFE_FONTBOUND value is valid. /// /// /// CFM_HIDDEN /// The CFE_HIDDEN value is valid. /// /// /// CFM_IMPRINT /// The CFE_IMPRINT value is valid. /// /// /// CFM_ITALIC /// The CFE_ITALIC value is valid. /// /// /// CFM_LINK /// The CFE_LINK value is valid. /// /// /// CFM_LINKPROTECTED /// The CFE_LINKPROTECTED value is valid. /// /// /// CFM_MATH /// The CFE_MATH value is valid. /// /// /// CFM_MATHNOBUILDUP /// The CFE_MATHNOBUILDUP value is valid. /// /// /// CFM_MATHORDINARY /// The CFE_MATHORDINARY value is valid. /// /// /// CFM_OUTLINE /// The CFE_OUTLINE value is valid. /// /// /// CFM_PROTECTED /// The CFE_PROTECTED value is valid. /// /// /// CFM_REVISED /// The CFE_REVISION value is valid. /// /// /// CFM_SHADOW /// The CFE_SHADOW value is valid. /// /// /// CFM_SMALLCAPS /// The CFE_SMALLCAPS value is valid. /// /// /// CFM_STRIKEOUT /// The CFE_STRIKEOUT value is valid. /// /// /// CFM_SUBSCRIPT /// The CFE_SUBSCRIPT and CFE_SUPERSCRIPT values are valid. /// /// /// CFM_SUPERSCRIPT /// The CFE_SUBSCRIPT and CFE_SUPERSCRIPT values are valid. /// /// /// CFM_UNDERLINE /// The CFE_UNDERLINE value is valid. /// /// ///  /// Set the following values to indicate the valid structure members. /// /// /// Value /// Meaning /// /// /// CFM_ANIMATION /// The bAnimation member is valid. /// /// /// CFM_BACKCOLOR /// The crBackColor member is valid. /// /// /// CFM_CHARSET /// The bCharSet member is valid. /// /// /// CFM_COLOR /// /// The crTextColor member is valid unless the CFE_AUTOCOLOR flag is set in the dwEffects member. /// /// /// /// CFM_FACE /// The szFaceName member is valid. /// /// /// CFM_KERNING /// The wKerning member is valid. /// /// /// CFM_LCID /// The lcid member is valid. /// /// /// CFM_OFFSET /// The yOffset member is valid. /// /// /// CFM_REVAUTHOR /// The bRevAuthor member is valid. /// /// /// CFM_SIZE /// The yHeight member is valid. /// /// /// CFM_SPACING /// The sSpacing member is valid. /// /// /// CFM_STYLE /// The sStyle member is valid. /// /// /// CFM_UNDERLINETYPE /// The bUnderlineType member is valid. /// /// /// CFM_WEIGHT /// The wWeight member is valid. /// /// /// public CFM dwMask; /// /// Type: DWORD /// /// A set of bit flags that specify character effects. Some of the flags are included only for compatibility with Microsoft Text /// Object Model (TOM) interfaces; the rich edit control stores the value but does not use it to display text. /// /// This member can be a combination of the following values. /// /// /// Value /// Meaning /// /// /// CFE_ALLCAPS /// /// Characters are all capital letters. The value does not affect the way the control displays the text. This value applies only to /// versions earlier than Microsoft Rich Edit 3.0. /// /// /// /// CFE_AUTOBACKCOLOR /// /// The background color is the return value of GetSysColor( COLOR_WINDOW). If this flag is set, crBackColor member is ignored. /// /// /// /// CFE_AUTOCOLOR /// /// The text color is the return value of GetSysColor( COLOR_WINDOWTEXT). If this flag is set, the crTextColor member /// is ignored. /// /// /// /// CFE_BOLD /// Characters are bold. /// /// /// CFE_DISABLED /// Characters are displayed with a shadow that is offset by 3/4 point or one pixel, whichever is larger. /// /// /// CFE_EMBOSS /// Characters are embossed. The value does not affect how the control displays the text. /// /// /// CFE_EXTENDED /// /// The characters are less common members of a script. A font that supports a script should check if it has glyphs for such characters. /// /// /// /// CFE_FONTBOUND /// /// Font is chosen by the rich edit control because the active font doesn’t support the characters. This process is called font binding. /// /// /// /// CFE_HIDDEN /// For Microsoft Rich Edit 3.0 and later, characters are not displayed. /// /// /// CFE_IMPRINT /// /// Characters are displayed as imprinted characters. The value does not affect how the control displays the text. /// /// /// /// CFE_ITALIC /// Characters are italic. /// /// /// CFE_LINK /// /// A rich edit control can send EN_LINK notification codes when it receives mouse messages while the mouse pointer is over text with /// the CFE_LINK effect. /// /// /// /// CFE_LINKPROTECTED /// Characters are part of a friendly name link. /// /// /// CFE_MATH /// Characters are in a math zone. /// /// /// CFE_MATHNOBUILDUP /// /// Characters do not participate in a math build up. For example, when applied to a /, the / will not be used to build up a fraction. /// /// /// /// CFE_MATHORDINARY /// Characters are displayed as ordinary text within a math zone. /// /// /// CFE_OUTLINE /// Characters are displayed as outlined characters. The value does not affect how the control displays the text. /// /// /// CFE_PROTECTED /// Characters are protected; an attempt to modify them will cause an EN_PROTECTED notification code. /// /// /// CFE_REVISED /// Characters are marked as revised. /// /// /// CFE_SHADOW /// Characters are displayed as shadowed characters. The value does not affect how the control displays the text. /// /// /// CFE_SMALLCAPS /// Characters are in small capital letters. The value does not affect how the control displays the text. /// /// /// CFE_STRIKEOUT /// Characters are struck out. /// /// /// CFE_SUBSCRIPT /// /// Characters are subscript. The CFE_SUPERSCRIPT and CFE_SUBSCRIPT values are mutually exclusive. For both values, the /// control automatically calculates an offset and a smaller font size. Alternatively, you can use the yHeight and /// yOffset members to explicitly specify font size and offset for subscript and superscript characters. /// /// /// /// CFE_SUPERSCRIPT /// Characters are superscript. /// /// /// CFE_UNDERLINE /// Characters are underlined. /// /// /// public CFE dwEffects; /// /// Type: LONG /// /// Specifies the character height, in twips (1/1440 of an inch, or 1/20 of a printer's point). To use this member, set the /// CFM_SIZE flag in the dwMask member. /// /// public int yHeight; /// /// Type: LONG /// /// Character offset from the baseline, in twips. If the value of this member is positive, the character is a superscript; if the /// value is negative, the character is a subscript. To use this member, set the CFM_OFFSET flag in the dwMask member. /// /// public int yOffset; /// /// Type: COLORREF /// /// Text color. To use this member, set the CFM_COLOR flag in the dwMask member. This member is ignored if the /// CFE_AUTOCOLOR character effect is specified. To generate a COLORREF, use the RGB macro. /// /// public COLORREF crTextColor; /// /// Type: BYTE /// /// Character set value. It can be one of the values specified for the lfCharSet member of the LOGFONT structure. To use this /// member, set the CFM_CHARSET flag in the dwMask member. /// /// public CharacterSet bCharSet; /// /// Type: BYTE /// Specifies the font family and pitch. This member is the same as the lfPitchAndFamily member of the LOGFONT structure. /// public FontPitch bPitchAndFamily; /// /// Type: TCHAR[LF_FACESIZE] /// /// A null-terminated character array specifying the font name. To use this member, set the CFM_FACE flag in the dwMask member. /// /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szFaceName; /// /// Type: WORD /// /// Font weight. This member is the same as the member of the LOGFONT structure. To use this member, /// set the CFM_WEIGHT flag in the dwMask member. /// /// public ushort wWeight; /// /// Type: SHORT /// /// Horizontal space between letters, in twips. This value has no effect on the text displayed by a rich edit control; it is included /// for compatibility with Windows TOM interfaces. To use this member, set the CFM_SPACING flag in the dwMask member. /// /// public short sSpacing; /// /// Type: COLORREF /// /// Background color. To use this member, set the CFM_BACKCOLOR flag in the dwMask member. This member is ignored if /// the CFE_AUTOBACKCOLOR character effect is specified. To generate a , use the macro. /// /// public COLORREF crBackColor; /// /// Type: LCID /// /// A 32-bit locale identifier that contains a language identifier in the lower word and a sorting identifier and reserved value in /// the upper word. This member has no effect on the text displayed by a rich edit control, but spelling and grammar checkers can use /// it to deal with language-dependent problems. You can use the macro to create an LCID value. To use this member, set the /// CFM_LCID flag in the dwMask member. /// /// public LCID lcid; /// /// Type: DWORD /// Reserved; the value must be zero. /// public uint dwReserved; /// /// Type: DWORD /// Client cookie. This member is opaque to a rich edit control. /// public uint dwCookie; /// /// Type: SHORT /// /// Character style handle. This value has no effect on the text displayed by a rich edit control; it is included for compatibility /// with WindowsTOM interfaces. To use this member, set the CFM_STYLE flag in the dwMask member. For more information /// see the TOM documentation. /// /// public short sStyle; /// /// Type: WORD /// /// Value of the font size, above which to kern the character ( yHeight). This value has no effect on the text displayed by a /// rich edit control; it is included for compatibility with TOM interfaces. To use this member, set the CFM_KERNING flag in /// the dwMask member. /// /// public ushort wKerning; /// /// Type: BYTE /// /// Specifies the underline type. To use this member, set the CFM_UNDERLINETYPE flag in the dwMask member. This member /// can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// CFU_CF1UNDERLINE /// /// The structure maps CHARFORMAT's bit underline to CHARFORMAT2, (that is, it performs a CHARFORMAT type of underline /// on this text). /// /// /// /// CFU_INVERT /// For IME composition, fake a selection. /// /// /// CFU_UNDERLINE /// Text underlined with a single solid line. /// /// /// CFU_UNDERLINEDASH /// Text underlined with dashes. /// /// /// CFU_UNDERLINEDASHDOT /// Text underlined with a dashed and dotted line. /// /// /// CFU_UNDERLINEDASHDOTDOT /// Text underlined with a dashed and doubled dotted line. /// /// /// CFU_UNDERLINEDOTTED /// /// Text underlined with a dotted line. For versions earlier than Microsoft Rich Edit 3.0, text is displayed with a solid underline. /// /// /// /// CFU_UNDERLINEDOUBLE /// Text underlined with a double line. The rich edit control displays the text with a solid underline. /// /// /// CFU_UNDERLINEDOUBLEWAVE /// Display as CFU_UNDERLINEWAVE. /// /// /// CFU_UNDERLINEHAIRLINE /// Display as CFU_UNDERLINE. /// /// /// CFU_UNDERLINEHEAVYWAVE /// Display as CFU_UNDERLINEWAVE. /// /// /// CFU_UNDERLINELONGDASH /// Display as CFU_UNDERLINEDASH. /// /// /// CFU_UNDERLINENONE /// No underline. This is the default. /// /// /// CFU_UNDERLINETHICK /// Display as CFU_UNDERLINE. /// /// /// CFU_UNDERLINETHICKDASH /// Display as CFU_UNDERLINEDASH. /// /// /// CFU_UNDERLINETHICKDASHDOT /// Display as CFU_UNDERLINEDASHDOT. /// /// /// CFU_UNDERLINETHICKDASHDOTDOT /// Display as CFU_UNDERLINEDASHDOT. /// /// /// CFU_UNDERLINETHICKDOTTED /// Display as CFU_UNDERLINEDOT. /// /// /// CFU_UNDERLINETHICKLONGDASH /// Display as CFU_UNDERLINEDASH. /// /// /// CFU_UNDERLINEWAVE /// RichEdit 4.1 and later: Text underlined with a wavy line. /// /// /// CFU_UNDERLINEWORD /// /// RichEdit 4.1 and later: Underline words only. The rich edit control displays the text with a solid underline. /// /// /// /// public CFU bUnderlineType; /// /// Type: BYTE /// /// Text animation type. This value has no effect on the text displayed by a rich edit control; it is included for compatibility with /// TOM interfaces. To use this member, set the CFM_ANIMATION flag in the dwMask member. /// /// public byte bAnimation; /// /// Type: BYTE /// /// An index that identifies the author making a revision. The rich edit control uses different text colors for each different author /// index. To use this member, set the CFM_REVAUTHOR flag in the dwMask member. /// /// public byte bRevAuthor; /// /// Type: BYTE /// Underline color: /// /// /// UnderlineColor_Black = 0x00; /// /// /// UnderlineColor_Blue = 0x01; /// /// /// UnderlineColor_Aqua = 0x02; /// /// /// UnderlineColor_Lime = 0x03; /// /// /// UnderlineColor_Fuchsia = 0x04; /// /// /// UnderlineColor_Red = 0x05; /// /// /// UnderlineColor_Yellow = 0x06; /// /// /// UnderlineColor_White = 0x07; /// /// /// UnderlineColor_Navy = 0x08; /// /// /// UnderlineColor_Teal = 0x09; /// /// /// UnderlineColor_Green = 0x0A; /// /// /// UnderlineColor_Purple = 0x0B; /// /// /// UnderlineColor_Maroon = 0x0C; /// /// /// UnderlineColor_Olive = 0x0D; /// /// /// UnderlineColor_DkGray = 0x0E; /// /// /// UnderlineColor_LtGray = 0x0F; /// /// /// public byte bUnderlineColor; } /// /// Specifies a range of characters in a rich edit control. /// /// If the cpMin and cpMax members are equal, the range is empty. The range includes everything if cpMin is 0 and /// cpMax is –1. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-charrange typedef struct _charrange { LONG cpMin; LONG cpMax; // } CHARRANGE; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._charrange")] [StructLayout(LayoutKind.Sequential)] public struct CHARRANGE { /// /// Type: LONG /// Character position index immediately preceding the first character in the range. /// public int cpMin; /// /// Type: LONG /// Character position immediately following the last character in the range. /// public int cpMax; } /// Specifies the clipboard format. This structure included with the EN_CLIPFORMAT notification. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-clipboardformat typedef struct _clipboardformat { NMHDR // nmhdr; CLIPFORMAT cf; } CLIPBOARDFORMAT; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._clipboardformat")] [StructLayout(LayoutKind.Sequential)] public struct CLIPBOARDFORMAT : INotificationInfo { /// /// Type: NMHDR /// Structure that contains information about this notification message. /// public NMHDR nmhdr; /// /// Type: DWORD /// A clipboard format registered by a call to the RegisterClipboardFormat function. /// public CLIPFORMAT cf; } /// Contains color settings for a composition string. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-compcolor typedef struct _compcolor { COLORREF crText; // COLORREF crBackground; DWORD dwEffects; } COMPCOLOR; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._compcolor")] [StructLayout(LayoutKind.Sequential)] public struct COMPCOLOR { /// /// Type: COLORREF /// Color of text. To generate a COLORREF, use the RGB macro. /// public COLORREF crText; /// /// Type: COLORREF /// Color of background. To generate a COLORREF, use the RGB macro. /// public COLORREF crBackground; /// /// Type: DWORD /// Character effect values as described for the dwEffects member in the CHARFORMAT structure. /// public CFE dwEffects; } /// /// Contains information that an application passes to a rich edit control in a EM_STREAMIN or EM_STREAMOUT message. The rich edit /// control uses the information to transfer a stream of data into or out of the control. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-editstream typedef struct _editstream { DWORD_PTR dwCookie; // DWORD dwError; EDITSTREAMCALLBACK pfnCallback; } EDITSTREAM; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._editstream")] [StructLayout(LayoutKind.Sequential)] public struct EDITSTREAM { /// /// Type: DWORD_PTR /// /// Specifies an application-defined value that the rich edit control passes to the EditStreamCallback callback function specified by /// the pfnCallback member. /// /// public IntPtr dwCookie; /// /// Type: DWORD /// /// Indicates the results of the stream-in (read) or stream-out (write) operation. A value of zero indicates no error. A nonzero /// value can be the return value of the EditStreamCallback function or a code indicating that the control encountered an error. /// /// public uint dwError; /// /// Type: EDITSTREAMCALLBACK /// /// Pointer to an EditStreamCallback function, which is an application-defined function that the control calls to transfer data. The /// control calls the callback function repeatedly, transferring a portion of the data with each call. /// /// [MarshalAs(UnmanagedType.FunctionPtr)] public EDITSTREAMCALLBACK pfnCallback; } /// Contains information about the selected text to be corrected. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-encorrecttext typedef struct _encorrecttext { NMHDR nmhdr; // CHARRANGE chrg; WORD seltyp; } ENCORRECTTEXT; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._encorrecttext")] [StructLayout(LayoutKind.Sequential)] public struct ENCORRECTTEXT : INotificationInfo { /// /// Type: NMHDR /// An NMHDR structure. The code member of this structure identifies the notification code being sent. /// public NMHDR nmhdr; /// /// Type: CHARRANGE /// A CHARRANGE structure that specifies the range of selected characters. /// public CHARRANGE chrg; /// /// Type: WORD /// /// Value specifying the contents of the new selection. This member is SEL_EMPTY if the selection is empty or one or more of the /// following values. /// /// /// /// Value /// Meaning /// /// /// SEL_TEXT /// The new selection contains text. /// /// /// SEL_OBJECT /// The new selection contains at least one COM object. /// /// /// SEL_MULTICHAR /// The new selection contains more than one character of text. /// /// /// SEL_MULTIOBJECT /// The new selection contains more than one COM object. /// /// /// public SEL seltyp; } /// Contains information about an EN_ENDCOMPOSITION notification code from a rich edit control. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-endcompositionnotify typedef struct _endcomposition { NMHDR // nmhdr; DWORD dwCode; } ENDCOMPOSITIONNOTIFY; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._endcomposition")] [StructLayout(LayoutKind.Sequential)] public struct ENDCOMPOSITIONNOTIFY : INotificationInfo { /// The code member of this structure identifies the notification code being sent. public NMHDR nmhdr; /// /// Indicates the state of the composition. This member is one of the following values. /// /// /// Value /// Meaning /// /// /// ECN_ENDCOMPOSITION 1 /// The composition is complete. /// /// /// ECN_NEWTEXT 2 /// There are new characters in the composition. /// /// /// public ECN dwCode; } /// /// Contains information associated with an EN_DROPFILES notification code. A rich edit control sends this notification code when it /// receives a WM_DROPFILES message. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-endropfiles typedef struct _endropfiles { NMHDR nmhdr; HANDLE // hDrop; LONG cp; BOOL fProtected; } ENDROPFILES; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._endropfiles")] [StructLayout(LayoutKind.Sequential)] public struct ENDROPFILES : INotificationInfo { /// /// Type: NMHDR /// Notification header. /// public NMHDR nmhdr; /// /// Type: HANDLE /// /// Handle to the dropped files list (same as with WM_DROPFILES ). This handle is used with the DragFinish, DragQueryFile, and /// DragQueryPoint functions. /// /// public HDROP hDrop; /// /// Type: LONG /// Character position at which the dropped files would be inserted. /// public int cp; /// /// Type: BOOL /// Indicates whether the specified character position is protected ( TRUE) or not protected ( FALSE). /// [MarshalAs(UnmanagedType.Bool)] public bool fProtected; } /// Contains information about an EN_LINK notification code from a rich edit control. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-enlink typedef struct _enlink { NMHDR nmhdr; UINT msg; WPARAM // wParam; LPARAM lParam; CHARRANGE chrg; } ENLINK; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._enlink")] [StructLayout(LayoutKind.Sequential)] public struct ENLINK : INotificationInfo { /// /// Type: NMHDR /// The code member of this structure identifies the notification code being sent. /// public NMHDR nmhdr; /// /// Type: UINT /// Identifier of the message that caused the rich edit control to send the EN_LINK notification code. /// public uint msg; /// /// Type: WPARAM /// The wParam parameter of the message received by the rich edit control. /// public IntPtr wParam; /// /// Type: LPARAM /// The lParam parameter of the message received by the rich edit control. /// public IntPtr lParam; /// /// Type: CHARRANGE /// The range of consecutive characters in the rich edit control that have the CFE_LINK effect. /// public CHARRANGE chrg; } /// Contains information about an unsupported Rich Text Format (RTF) keyword in a Microsoft Rich Edit control. /// This structure is used with the EN_LOWFIRTF message. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-enlowfirtf typedef struct _enlowfirtf { NMHDR nmhdr; char // *szControl; } ENLOWFIRTF; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._enlowfirtf")] [StructLayout(LayoutKind.Sequential)] public struct ENLOWFIRTF : INotificationInfo { /// /// Type: NMHDR /// Specifies an NMHDR structure. /// public NMHDR nmhdr; /// /// Type: CHAR* /// The unsupported RTF keyword. /// public IntPtr szControl; } /// Contains information about a failed operation. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-enoleopfailed typedef struct _enoleopfailed { NMHDR nmhdr; // LONG iob; LONG lOper; HRESULT hr; } ENOLEOPFAILED; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._enoleopfailed")] [StructLayout(LayoutKind.Sequential)] public struct ENOLEOPFAILED : INotificationInfo { /// /// Type: NMHDR /// NMHDR notification header. /// public NMHDR nmhdr; /// /// Type: LONG /// Object index. /// public int iob; /// /// Type: LONG /// Operation that failed. This can be OLEOP_DOVERB to indicate that IOleObject::DoVerb failed. /// public OLEOP lOper; /// /// Type: HRESULT /// Error code returned by the object on the operation. /// public HRESULT hr; } /// /// Contains information associated with an EN_PROTECTED notification code. A rich edit control sends this notification when the user /// attempts to edit protected text. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-enprotected typedef struct _enprotected { NMHDR nmhdr; UINT // msg; WPARAM wParam; LPARAM lParam; CHARRANGE chrg; } ENPROTECTED; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._enprotected")] [StructLayout(LayoutKind.Sequential)] public struct ENPROTECTED : INotificationInfo { /// /// Type: NMHDR /// NMHDR notification header. /// public NMHDR nmhdr; /// /// Type: UINT /// Message that triggered the notification. /// public uint msg; /// /// Type: WPARAM /// The wParam parameter of the message. /// public IntPtr wParam; /// /// Type: LPARAM /// The lParam parameter of the message. /// public IntPtr lParam; /// /// Type: CHARRANGE /// The current selection. /// public CHARRANGE chrg; } /// Contains information about objects and text on the clipboard. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-ensaveclipboard typedef struct _ensaveclipboard { NMHDR // nmhdr; LONG cObjectCount; LONG cch; } ENSAVECLIPBOARD; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._ensaveclipboard")] [StructLayout(LayoutKind.Sequential)] public struct ENSAVECLIPBOARD : INotificationInfo { /// /// Type: NMHDR /// NMHDR notification header. /// public NMHDR nmhdr; /// /// Type: LONG /// Number of objects on the clipboard. /// public int cObjectCount; /// /// Type: LONG /// Number of characters on the clipboard. /// public int cch; } /// Contains information about a search operation in a rich edit control. This structure is used with the EM_FINDTEXT message. /// /// Note /// /// The richedit.h header defines FINDTEXT as an alias which automatically selects the ANSI or Unicode version of this function based on /// the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral /// can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-findtextw typedef struct _findtextw { CHARRANGE chrg; LPCWSTR // lpstrText; } FINDTEXTW; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._findtextw")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct FINDTEXT { /// /// Type: CHARRANGE /// The range of characters to search. /// public CHARRANGE chrg; /// /// Type: LPCTSTR /// The null-terminated string used in the find operation. /// [MarshalAs(UnmanagedType.LPTStr)] public string lpstrText; } /// Contains information about text to search for in a rich edit control. This structure is used with the EM_FINDTEXTEX message. /// /// Note /// /// The richedit.h header defines FINDTEXTEX as an alias which automatically selects the ANSI or Unicode version of this function based /// on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not /// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for /// Function Prototypes. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-findtextexa typedef struct _findtextexa { CHARRANGE chrg; // LPCSTR lpstrText; CHARRANGE chrgText; } FINDTEXTEXA; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._findtextexa")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct FINDTEXTEX { /// /// Type: CHARRANGE /// The range of characters to search. To search forward in the entire control, set cpMin to 0 and cpMax to -1. /// public CHARRANGE chrg; /// /// Type: LPCTSTR /// The null-terminated string to find. /// [MarshalAs(UnmanagedType.LPTStr)] public string lpstrText; /// /// Type: CHARRANGE /// The range of characters in which the text was found. If the text was not found, cpMin and cpMax are -1. /// public CHARRANGE chrgText; } /// /// Information that a rich edit control uses to format its output for a particular device. This structure is used with the /// EM_FORMATRANGE message. /// /// /// /// hdcTarget contains the HDC to format for, which is usually the same as the HDC specified by hdc but can be different. /// For example, if you create a print preview module, hdc is the HDC of the window in which the output is viewed, and /// hdcTarget is the HDC for the printer. /// /// The values for rc and rcPage can be obtained by using GetDeviceCaps. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-formatrange typedef struct _formatrange { HDC hdc; HDC // hdcTarget; RECT rc; RECT rcPage; CHARRANGE chrg; } FORMATRANGE; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._formatrange")] [StructLayout(LayoutKind.Sequential)] public struct FORMATRANGE { /// /// Type: HDC /// A HDC for the device to render to, if EM_FORMATRANGE is being used to send the output to a device. /// public HDC hdc; /// /// Type: HDC /// An HDC for the target device to format for. /// public HDC hdcTarget; /// /// Type: RECT /// The area within the rcPage rectangle to render to. Units are measured in twips. /// public RECT rc; /// /// Type: RECT /// The entire area of a page on the rendering device. Units are measured in twips. /// public RECT rcPage; /// /// Type: CHARRANGE /// The range of characters to format. /// public CHARRANGE chrg; } /// Contains context menu information that is passed to the IRichEditOleCallback::GetContextMenu method. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-getcontextmenuex typedef struct _getcontextmenuex { CHARRANGE // chrg; DWORD dwFlags; POINT pt; void *pvReserved; } GETCONTEXTMENUEX; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._getcontextmenuex")] [StructLayout(LayoutKind.Sequential)] public struct GETCONTEXTMENUEX { /// /// Type: CHARRANGE /// The character-position range in the active display. /// public CHARRANGE chrg; /// /// Type: DWORD /// One or more of the following content menu flags: /// /// /// Value /// Meaning /// /// /// GCMF_GRIPPER /// Get the context menu that is invoked by tapping a touch gripper handle. /// /// /// GCMF_SPELLING /// Get the context menu for a spelling error. /// /// /// GCMF_MOUSEMENU /// Get the context menu that is invoked by mouse. /// /// /// GCMF_TOUCHMENU /// Get the context menu that is invoked by touch. /// /// /// public GCMF dwFlags; /// /// Type: POINT /// The screen coordinates for the content menu. /// public POINT pt; /// /// Type: void* /// Not used; must be zero. /// public IntPtr pvReserved; } /// Contains information used in getting text from a rich edit control. This structure used with the EM_GETTEXTEX message. /// The EM_GETTEXTEX message is faster when both lpDefaultChar and lpUsedDefChar are NULL. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-gettextex typedef struct _gettextex { DWORD cb; DWORD flags; // UINT codepage; LPCSTR lpDefaultChar; LPBOOL lpUsedDefChar; } GETTEXTEX; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._gettextex")] [StructLayout(LayoutKind.Sequential)] public struct GETTEXTEX { /// /// Type: DWORD /// The size, in bytes, of the buffer used to store the retrieved text. /// public uint cb; /// /// Type: DWORD /// Value specifying a text operation. This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// GT_DEFAULT /// All text is retrieved according to the following criteria: /// /// /// Carriage returns (U+000D) are not translated into CRLF (U+000D U+000A). /// /// /// Table and math-object structure characters are removed(see GT_RAWTEXT). /// /// /// Hidden text is included. /// /// /// List numbers are not included. /// /// /// /// /// /// GT_NOHIDDENTEXT /// Hidden text is not included in the retrieved text. /// /// /// GT_RAWTEXT /// /// Text is retrieved exactly as it appears in memory. This includes special structure characters for table row and cell delimiters /// (see Remarks for EM_INSERTTABLE) as well as math object delimiters (start delimiter U+FDD0, argument delimiter U+FDEE, and end /// delimiter U+FDDF) and object markers (U+FFFC). This maintains character-position alignment between the retrieved text and the /// text in memory. /// /// /// /// GT_SELECTION /// Retrieve the text for the current selection. /// /// /// GT_USECRLF /// When copying text, translate each CR into a CR/LF. /// /// /// public GT flags; /// /// Type: UINT /// Code page used in the translation. It is CP_ACP for ANSI code page and 1200 for Unicode. /// public uint codepage; /// /// Type: LPCSTR /// /// The character used if a wide character cannot be represented in the specified code page. It is used only if the code page is /// not 1200 (Unicode). If this member is NULL, a system default value is used. /// /// [MarshalAs(UnmanagedType.LPStr)] public string lpDefaultChar; /// /// Type: LPBOOL /// /// A flag that indicates whether the default character ( lpDefaultChar) was used. This member is used only if the code page /// is not 1200 or CP_UTF8 (Unicode). The flag is TRUE if one or more wide characters in the source string cannot be /// represented in the specified code page. Otherwise, the flag is FALSE. This member can be NULL. /// /// public IntPtr lpUsedDefChar; } /// /// Contains information about how the text length of a rich edit control should be calculated. This structure is passed in the /// wParam in the EM_GETTEXTLENGTHEX message. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-gettextlengthex typedef struct _gettextlengthex { DWORD // flags; UINT codepage; } GETTEXTLENGTHEX; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._gettextlengthex")] [StructLayout(LayoutKind.Sequential)] public struct GETTEXTLENGTHEX { /// /// Type: DWORD /// /// Value specifying the method to be used in determining the text length. This member can be one or more of the following values /// (some values are mutually exclusive). /// /// /// /// Value /// Meaning /// /// /// GTL_DEFAULT /// Returns the number of characters. This is the default. /// /// /// GTL_USECRLF /// Computes the answer by using CR/LFs at the end of paragraphs. /// /// /// GTL_PRECISE /// /// Computes a precise answer. This approach could necessitate a conversion and thereby take longer. This flag cannot be used with /// the GTL_CLOSE flag. E_INVALIDARG will be returned if both are used. /// /// /// /// GTL_CLOSE /// /// Computes an approximate (close) answer. It is obtained quickly and can be used to set the buffer size. This flag cannot be used /// with the GTL_PRECISE flag. E_INVALIDARG will be returned if both are used. /// /// /// /// GTL_NUMCHARS /// /// Returns the number of characters. This flag cannot be used with the GTL_NUMBYTES flag. E_INVALIDARG will be returned if both are used. /// /// /// /// GTL_NUMBYTES /// /// Returns the number of bytes. This flag cannot be used with the GTL_NUMCHARS flag. E_INVALIDARG will be returned if both are used. /// /// /// /// public GTL flags; /// /// Type: UINT /// Code page used in the translation. It is CP_ACP for ANSI Code Page and 1200 for Unicode. /// public uint codepage; } /// Contains information about hyphenation in a Microsoft Rich Edit control. /// This structure is used with the EM_GETHYPHENATEINFO and EM_SETHYPHENATEINFO messages. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-hyphenateinfo typedef struct tagHyphenateInfo { SHORT cbSize; // SHORT dxHyphenateZone; void((WCHAR *,LANGID, long,HYPHRESULT *) * )pfnHyphenate; } HYPHENATEINFO; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit.tagHyphenateInfo")] [StructLayout(LayoutKind.Sequential)] public struct HYPHENATEINFO { /// /// Type: SHORT /// Size of the HYPHENATEINFO structure, in bytes. /// public short cbSize; /// /// Type: SHORT /// /// Size, in TWIPS (one TWIP is 1/1440 inch), of the area near the margin that excludes hyphenation. If a space character is closer /// to the margin than this value, do not hyphenate the following word. /// /// public short dxHyphenateZone; private IntPtr pfn; /// /// Type: PFNHYPHENATEPROC /// The client-defined HyphenateProc callback function. /// public Action pfnHyphenate { get => (Action)Marshal.GetDelegateForFunctionPointer(pfn, typeof(Action)); set => pfn = Marshal.GetFunctionPointerForDelegate(value); } } /// Contains information about the result of hyphenation in a Microsoft Rich Edit control. /// This structure is used with the HYPHENATEINFO structure. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-hyphresult typedef struct hyphresult { KHYPH khyph; long // ichHyph; WCHAR chHyph; } HYPHRESULT; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit.hyphresult")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HYPHRESULT { /// /// Type: KHYPH /// The type of hyphenation. /// public KHYPH khyph; /// /// Type: LONG /// The index of the WCHAR in the passed string where hyphenation occurred. /// public long ichHyph; /// /// Type: WCHAR /// /// The character used when hyphenation requires a replacement or an addition or a change. If no new character is needed, the value /// is zero. /// /// public char chHyph; } /// Contains information about the Input Method Editor (IME) composition text in a Microsoft Rich Edit control. /// This structure is used with the EM_GETIMECOMPTEXT message. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-imecomptext typedef struct _imecomptext { LONG cb; DWORD // flags; } IMECOMPTEXT; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._imecomptext")] [StructLayout(LayoutKind.Sequential)] public struct IMECOMPTEXT { /// /// Type: LONG /// Size of the output buffer, in bytes. /// public int cb; /// /// Type: DWORD /// Type of composition string. It can be one of the following values. /// /// /// Value /// Meaning /// /// /// ICT_RESULTREADSTR /// The final composed string. /// /// /// public ICT flags; } /// /// Contains information about a keyboard or mouse event. A rich edit control sends this structure to its parent window as part of an /// EN_MSGFILTER notification code, enabling the parent to change the message or prevent it from being processed. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-msgfilter typedef struct _msgfilter { NMHDR nmhdr; UINT msg; // WPARAM wParam; LPARAM lParam; } MSGFILTER; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._msgfilter")] [StructLayout(LayoutKind.Sequential)] public struct MSGFILTER : INotificationInfo { /// /// Type: NMHDR /// The code member of the NMHDR structure is the EN_MSGFILTER notification code that identifies the message being sent. /// public NMHDR nmhdr; /// /// Type: UINT /// Keyboard or mouse message identifier. /// public uint msg; /// /// Type: WPARAM /// The wParam parameter of the message. /// public IntPtr wParam; /// /// Type: LPARAM /// The lParam parameter of the message. /// public IntPtr lParam; } /// Contains object position information. /// This is used in the EN_OBJECTPOSITIONS notification. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-objectpositions typedef struct _objectpositions { NMHDR // nmhdr; LONG cObjectCount; LONG *pcpPositions; } OBJECTPOSITIONS; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._objectpositions")] [StructLayout(LayoutKind.Sequential)] public struct OBJECTPOSITIONS : INotificationInfo { /// /// Type: NMHDR /// The code member of this structure identifies the notification code being sent. /// public NMHDR nmhdr; /// /// Type: LONG /// Number of object positions. /// public int cObjectCount; /// /// Type: LONG* /// The object positions. /// public IntPtr pcpPositions; } /// /// /// Contains information about paragraph formatting attributes in a rich edit control. This structure is used with the EM_GETPARAFORMAT /// and EM_SETPARAFORMAT messages. /// /// /// In Microsoft Rich Edit 2.0, the PARAFORMAT2 structure is a Microsoft Rich Edit 2.0 extension of the PARAFORMAT structure. /// Microsoft Rich Edit 2.0 allows you to use either structure with EM_GETPARAFORMAT and EM_SETPARAFORMAT. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-paraformat typedef struct _paraformat { UINT cbSize; DWORD // dwMask; WORD wNumbering; union { WORD wReserved; WORD wEffects; }; LONG dxStartIndent; LONG dxRightIndent; LONG dxOffset; WORD // wAlignment; SHORT cTabCount; LONG rgxTabs[MAX_TAB_STOPS]; } PARAFORMAT; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._paraformat")] [StructLayout(LayoutKind.Sequential)] public struct PARAFORMAT { /// /// Type: UINT /// Structure size, in bytes. The member must be filled before passing to the rich edit control. /// public uint cbSize; /// /// Type: DWORD /// /// Members containing valid information or attributes to set. This parameter can be none or a combination of the following values. /// If both PFM_STARTINDENT and PFM_OFFSETINDENT are specified, PFM_STARTINDENT takes precedence. /// /// /// /// Value /// Meaning /// /// /// PFM_ALIGNMENT /// The wAlignment member is valid. /// /// /// PFM_NUMBERING /// The wNumbering member is valid. /// /// /// PFM_OFFSET /// The dxOffset member is valid. /// /// /// PFM_OFFSETINDENT /// The dxStartIndent member is valid and specifies a relative value. /// /// /// PFM_RIGHTINDENT /// The dxRightIndent member is valid. /// /// /// PFM_RTLPARA /// Rich Edit 2.0: The wEffects member is valid /// /// /// PFM_STARTINDENT /// The dxStartIndent member is valid. /// /// /// PFM_TABSTOPS /// The cTabStobs and rgxTabStops members are valid. /// /// /// public PFM dwMask; /// /// Type: WORD /// Value specifying numbering options. This member can be zero or PFN_BULLET. /// public PFN wNumbering; /// /// Type: WORD /// Rich Edit 1.0:: Reserved; the value must be zero. /// /// Rich Edit 2.0: A bit flag that specifies a paragraph effect. It is included only for compatibility with TOM interfaces; /// the rich edit control stores the value but does not use it to display the text. This parameter can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// Displays text using left-to-right reading order. This is the default. /// /// /// PFE_RLTPARA /// Displays text using right-to-left reading order. /// /// /// public PFE wEffects; /// /// Type: LONG /// /// Indentation of the first line in the paragraph, in twips. If the paragraph formatting is being set and PFM_OFFSETINDENT is /// specified, this member is treated as a relative value that is added to the starting indentation of each affected paragraph. /// /// public int dxStartIndent; /// /// Type: LONG /// Size, of the right indentation relative to the right margin, in twips. /// public int dxRightIndent; /// /// Type: LONG /// /// Indentation of the second and subsequent lines of a paragraph relative to the starting indentation, in twips. The first line is /// indented if this member is negative or outdented if this member is positive. /// /// public int dxOffset; /// /// Type: WORD /// Value specifying the paragraph alignment. This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// PFA_CENTER /// Paragraphs are centered. /// /// /// PFA_LEFT /// Paragraphs are aligned with the left margin. /// /// /// PFA_RIGHT /// Paragraphs are aligned with the right margin. /// /// /// public PFA wAlignment; /// /// Type: SHORT /// Number of tab stops. /// public short cTabCount; /// /// Type: LONG /// /// Array of absolute tab stop positions. Each element in the array specifies information about a tab stop. The 24 low-order bits /// specify the absolute offset, in twips. To use this member, set the PFM_TABSTOPS flag in the dwMask member. /// /// /// Rich Edit 2.0: For compatibility with TOM interfaces, you can use the eight high-order bits to store additional /// information about each tab stop. /// /// /// Bits 24-27 can specify one of the following values to indicate the tab alignment. These bits do not affect the rich edit control /// display for versions earlier than Microsoft Rich Edit 3.0. /// /// /// /// Value /// Meaning /// /// /// 0 /// Ordinary tab /// /// /// 1 /// Center tab /// /// /// 2 /// Right-aligned tab /// /// /// 3 /// Decimal tab /// /// /// 4 /// Word bar tab (vertical bar) /// /// ///  /// /// Bits 28-31 can specify one of the following values to indicate the type of tab leader. These bits do not affect the rich edit /// control display. /// /// /// /// Value /// Meaning /// /// /// 0 /// No leader /// /// /// 1 /// Dotted leader /// /// /// 2 /// Dashed leader /// /// /// 3 /// Underlined leader /// /// /// 4 /// Thick line leader /// /// /// 5 /// Double line leader /// /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32 /*MAX_TAB_STOPS*/)] public uint[] rgxTabs; } /// /// Contains information about paragraph formatting attributes in a rich edit control. PARAFORMAT2 is a Microsoft Rich Edit 2.0 /// extension of the PARAFORMAT structure. Microsoft Rich Edit 2.0 allows you to use either structure with the EM_GETPARAFORMAT and /// EM_SETPARAFORMAT messages. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-paraformat2 struct PARAFORMAT2 : _paraformat { LONG // dySpaceBefore; LONG dySpaceAfter; LONG dyLineSpacing; SHORT sStyle; BYTE bLineSpacingRule; BYTE bOutlineLevel; WORD wShadingWeight; // WORD wShadingStyle; WORD wNumberingStart; WORD wNumberingStyle; WORD wNumberingTab; WORD wBorderSpace; WORD wBorderWidth; WORD // wBorders; }; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit.PARAFORMAT2")] [StructLayout(LayoutKind.Sequential)] public struct PARAFORMAT2 { /// /// Type: UINT /// Structure size, in bytes. The member must be filled before passing to the rich edit control. /// public uint cbSize; /// /// Type: DWORD /// /// Members containing valid information or attributes to set. This parameter can be none or a combination of the following values. /// If both PFM_STARTINDENT and PFM_OFFSETINDENT are specified, PFM_STARTINDENT takes precedence. /// /// /// /// Value /// Meaning /// /// /// PFM_ALIGNMENT /// The wAlignment member is valid. /// /// /// PFM_NUMBERING /// The wNumbering member is valid. /// /// /// PFM_OFFSET /// The dxOffset member is valid. /// /// /// PFM_OFFSETINDENT /// The dxStartIndent member is valid and specifies a relative value. /// /// /// PFM_RIGHTINDENT /// The dxRightIndent member is valid. /// /// /// PFM_RTLPARA /// Rich Edit 2.0: The wEffects member is valid /// /// /// PFM_STARTINDENT /// The dxStartIndent member is valid. /// /// /// PFM_TABSTOPS /// The cTabStobs and rgxTabStops members are valid. /// /// /// public PFM dwMask; /// /// Type: WORD /// Value specifying numbering options. This member can be zero or PFN_BULLET. /// public PFN wNumbering; /// /// Type: WORD /// Rich Edit 1.0:: Reserved; the value must be zero. /// /// Rich Edit 2.0: A bit flag that specifies a paragraph effect. It is included only for compatibility with TOM interfaces; /// the rich edit control stores the value but does not use it to display the text. This parameter can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// Displays text using left-to-right reading order. This is the default. /// /// /// PFE_RLTPARA /// Displays text using right-to-left reading order. /// /// /// public PFE wEffects; /// /// Type: LONG /// /// Indentation of the first line in the paragraph, in twips. If the paragraph formatting is being set and PFM_OFFSETINDENT is /// specified, this member is treated as a relative value that is added to the starting indentation of each affected paragraph. /// /// public int dxStartIndent; /// /// Type: LONG /// Size, of the right indentation relative to the right margin, in twips. /// public int dxRightIndent; /// /// Type: LONG /// /// Indentation of the second and subsequent lines of a paragraph relative to the starting indentation, in twips. The first line is /// indented if this member is negative or outdented if this member is positive. /// /// public int dxOffset; /// /// Type: WORD /// Value specifying the paragraph alignment. This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// PFA_CENTER /// Paragraphs are centered. /// /// /// PFA_LEFT /// Paragraphs are aligned with the left margin. /// /// /// PFA_RIGHT /// Paragraphs are aligned with the right margin. /// /// /// public PFA wAlignment; /// /// Type: SHORT /// Number of tab stops. /// public short cTabCount; /// /// Type: LONG /// /// Array of absolute tab stop positions. Each element in the array specifies information about a tab stop. The 24 low-order bits /// specify the absolute offset, in twips. To use this member, set the PFM_TABSTOPS flag in the dwMask member. /// /// /// Rich Edit 2.0: For compatibility with TOM interfaces, you can use the eight high-order bits to store additional /// information about each tab stop. /// /// /// Bits 24-27 can specify one of the following values to indicate the tab alignment. These bits do not affect the rich edit control /// display for versions earlier than Microsoft Rich Edit 3.0. /// /// /// /// Value /// Meaning /// /// /// 0 /// Ordinary tab /// /// /// 1 /// Center tab /// /// /// 2 /// Right-aligned tab /// /// /// 3 /// Decimal tab /// /// /// 4 /// Word bar tab (vertical bar) /// /// ///  /// /// Bits 28-31 can specify one of the following values to indicate the type of tab leader. These bits do not affect the rich edit /// control display. /// /// /// /// Value /// Meaning /// /// /// 0 /// No leader /// /// /// 1 /// Dotted leader /// /// /// 2 /// Dashed leader /// /// /// 3 /// Underlined leader /// /// /// 4 /// Thick line leader /// /// /// 5 /// Double line leader /// /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32 /*MAX_TAB_STOPS*/)] public uint[] rgxTabs; /// /// Type: LONG /// /// Size of the spacing above the paragraph, in twips. To use this member, set the PFM_SPACEBEFORE flag in the dwMask member. /// The value must be greater than or equal to zero. /// /// public int dySpaceBefore; /// /// Type: LONG /// /// Specifies the size of the spacing below the paragraph, in twips. To use this member, set the PFM_SPACEAFTER flag in the /// dwMask member. The value must be greater than or equal to zero. /// /// public int dySpaceAfter; /// /// Type: LONG /// /// Spacing between lines. For a description of how this value is interpreted, see the bLineSpacingRule member. To use this /// member, set the PFM_LINESPACING flag in the dwMask member. /// /// public int dyLineSpacing; /// /// Type: SHORT /// /// Text style. To use this member, set the PFM_STYLE flag in the dwMask member. This member is included only for /// compatibility with TOM interfaces and Word; the rich edit control stores the value but does not use it to display the text. /// /// public short sStyle; /// /// Type: BYTE /// /// Type of line spacing. To use this member, set the PFM_LINESPACING flag in the dwMask member. This member can be one of the /// following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// Single spacing. The dyLineSpacing member is ignored. /// /// /// 1 /// One-and-a-half spacing. The dyLineSpacing member is ignored. /// /// /// 2 /// Double spacing. The dyLineSpacing member is ignored. /// /// /// 3 /// /// The dyLineSpacing member specifies the spacingfrom one line to the next, in twips. However, if dyLineSpacing /// specifies a value that is less than single spacing, the control displays single-spaced text. /// /// /// /// 4 /// /// The dyLineSpacing member specifies the spacing from one line to the next, in twips. The control uses the exact spacing /// specified, even if dyLineSpacing specifies a value that is less than single spacing. /// /// /// /// 5 /// /// The value of dyLineSpacing / 20 is the spacing, in lines, from one line to the next. Thus, setting dyLineSpacing to /// 20 produces single-spaced text, 40 is double spaced, 60 is triple spaced, and so on. /// /// /// /// public byte bLineSpacingRule; /// /// Type: BYTE /// Reserved; must be zero. /// public byte bOutlineLevel; /// /// Type: WORD /// /// Percentage foreground color used in shading. The wShadingStyle member specifies the foreground and background shading /// colors. A value of 5 indicates a shading color consisting of 5 percent foreground color and 95 percent background color. To use /// these members, set the PFM_SHADING flag in the dwMask member. This member is included only for compatibility with Word; /// the rich edit control stores the value but does not use it to display the text. /// /// public ushort wShadingWeight; /// /// Type: WORD /// /// Style and colors used for background shading. Bits 0 to 3 contain the shading style, bits 4 to 7 contain the foreground color /// index, and bits 8 to 11 contain the background color index. To use this member, set the PFM_SHADING flag in the dwMask /// member. This member is included only for compatibility with Word; the rich edit control stores the value but does not use it to /// display the text. /// /// The shading style can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// None /// /// /// 1 /// Dark horizontal /// /// /// 2 /// Dark vertical /// /// /// 3 /// Dark down diagonal /// /// /// 4 /// Dark up diagonal /// /// /// 5 /// Dark grid /// /// /// 6 /// Dark trellis /// /// /// 7 /// Light horizontal /// /// /// 8 /// Light vertical /// /// /// 9 /// Light down diagonal /// /// /// 10 /// Light up diagonal /// /// /// 11 /// Light grid /// /// /// 12 /// Light trellis /// /// ///  /// The foreground and background color indexes can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// Black /// /// /// 1 /// Blue /// /// /// 2 /// Cyan /// /// /// 3 /// Green /// /// /// 4 /// Magenta /// /// /// 5 /// Red /// /// /// 6 /// Yellow /// /// /// 7 /// White /// /// /// 8 /// Dark blue /// /// /// 9 /// Dark cyan /// /// /// 10 /// Dark green /// /// /// 11 /// Dark magenta /// /// /// 12 /// Dark red /// /// /// 13 /// Dark yellow /// /// /// 14 /// Dark gray /// /// /// 15 /// Light gray /// /// /// public ushort wShadingStyle; /// /// Type: WORD /// /// Starting number or Unicode value used for numbered paragraphs. Use this member in conjunction with the wNumbering member. /// This member is included only for compatibility with TOM interfaces; the rich edit control stores the value but does not use it to /// display the text or bullets. To use this member, set the PFM_NUMBERINGSTART flag in the dwMask member. /// /// public ushort wNumberingStart; /// /// Type: WORD /// /// Numbering style used with numbered paragraphs. Use this member in conjunction with the wNumbering member. This member is /// included only for compatibility with TOM interfaces; the rich edit control stores the value but rich edit versions earlier than /// 3.0 do not use it to display the text or bullets. To use this member, set the PFM_NUMBERINGSTYLE flag in the dwMask /// member. This member can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// PFNS_PAREN /// Follows the number with a right parenthesis. /// /// /// PFNS_PARENS /// Encloses the number in parentheses. /// /// /// PFNS_PERIOD /// Follows the number with a period. /// /// /// PFNS_PLAIN /// Displays only the number. /// /// /// PFNS_NONUMBER /// Continues a numbered list without applying the next number or bullet. /// /// /// PFNS_NEWNUMBER /// Starts a new number with wNumberingStart. /// /// /// public PFNS wNumberingStyle; /// /// Type: WORD /// /// Minimum space between a paragraph number and the paragraph text, in twips. Use this member in conjunction with the /// wNumbering member. The wNumberingTab member is included for compatibility with TOM interfaces; previous to /// Microsoft Rich Edit 3.0, the rich edit control stores the value but does not use it to display text. To use this member, set the /// PFM_NUMBERINGTAB flag in the dwMask member. /// /// public ushort wNumberingTab; /// /// Type: WORD /// /// The space between the border and the paragraph text, in twips. The wBorderSpace member is included for compatibility with /// Word; the rich edit control stores the values but does not use them to display text. To use this member, set the PFM_BORDER flag /// in the dwMask member. /// /// public ushort wBorderSpace; /// /// Type: WORD /// Border width, in twips. To use this member, set the PFM_BORDER flag in the dwMask member. /// public ushort wBorderWidth; /// /// Type: WORD /// /// Border location, style, and color. Bits 0 to 7 specify the border locations, bits 8 to 11 specify the border style, and bits 12 /// to 15 specify the border color index. To use this member, set the PFM_BORDER flag in the dwMask member. /// /// Specify the border locations using a combination of the following values in bits 0 to 7. /// /// /// Value /// Meaning /// /// /// 1 /// Left border. /// /// /// 2 /// Right border. /// /// /// 4 /// Top border. /// /// /// 8 /// Bottom border. /// /// /// 16 /// Inside borders. /// /// /// 32 /// Outside borders. /// /// /// 64 /// Autocolor. If this bit is set, the color index in bits 12 to 15 is not used. /// /// ///  /// Specify the border style using one of the following values for bits 8 to 11. /// /// /// Value /// Meaning /// /// /// 0 /// None /// /// /// 1 /// 3/ 4 point /// /// /// 2 /// 1 1/ 2 point /// /// /// 3 /// 2 1/ 4 point /// /// /// 4 /// 3 point /// /// /// 5 /// 4 1/ 2 point /// /// /// 6 /// 6 point /// /// /// 7 /// 3/ 4 point double /// /// /// 8 /// 1 1/ 2 point double /// /// /// 9 /// 2 1/ 4 point double /// /// /// 10 /// 3/ 4 point gray /// /// /// 11 /// 3/ 4 point gray dashed /// /// ///  /// /// Specify the border color using one of the following values for bits 12 to 15. This value is ignored if the autocolor bit (bit 6) /// is set. /// /// /// /// Value /// Meaning /// /// /// 0 /// Black /// /// /// 1 /// Blue /// /// /// 2 /// Cyan /// /// /// 3 /// Green /// /// /// 4 /// Magenta /// /// /// 5 /// Red /// /// /// 6 /// Yellow /// /// /// 7 /// White /// /// /// 8 /// Dark blue /// /// /// 9 /// Dark cyan /// /// /// 10 /// Dark green /// /// /// 11 /// Dark magenta /// /// /// 12 /// Dark red /// /// /// 13 /// Dark yellow /// /// /// 14 /// Dark gray /// /// /// 15 /// Light gray /// /// /// public ushort wBorders; } /// Contains information about the punctuation used in a rich edit control. /// This structure is used only in Asian-language versions of the operating system. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-punctuation typedef struct _punctuation { UINT iSize; LPSTR // szPunctuation; } PUNCTUATION; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._punctuation")] [StructLayout(LayoutKind.Sequential)] public struct PUNCTUATION { /// /// Type: UINT /// Size of buffer pointed to by the szPunctuation member, in bytes. /// public uint iSize; /// /// Type: LPSTR /// The buffer containing the punctuation characters. /// [MarshalAs(UnmanagedType.LPStr)] public string szPunctuation; } /// /// Contains information identifying whether the display aspect of a pasted object should be based on the content of the object or the /// icon that represent the object. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-repastespecial typedef struct _repastespecial { DWORD // dwAspect; DWORD_PTR dwParam; } REPASTESPECIAL; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._repastespecial")] [StructLayout(LayoutKind.Sequential)] public struct REPASTESPECIAL { /// /// Type: DWORD /// Display aspect. It can be one of the following values. /// /// /// Value /// Meaning /// /// /// DVASPECT_CONTENT /// Aspect is based on the content of the object. /// /// /// DVASPECT_ICON /// Aspect is based on the icon view of the object. /// /// /// public DVASPECT dwAspect; /// /// Type: DWORD_PTR /// Type: DWORD /// /// Aspect data. If dwAspect is DVASPECT_ICON, this member contains the handle to the metafile with the icon view of the object. /// /// public IntPtr dwParam; } /// /// Contains the requested size of a rich edit control. A rich edit control sends this structure to its parent window as part of an /// EN_REQUESTRESIZE notification code. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-reqresize typedef struct _reqresize { NMHDR nmhdr; RECT rc; } REQRESIZE; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._reqresize")] [StructLayout(LayoutKind.Sequential)] public struct REQRESIZE : INotificationInfo { /// /// Type: NMHDR /// Notification header. /// public NMHDR nmhdr; /// /// Type: RECT /// Requested new size. /// public RECT rc; } /// Defines the attributes of an image to be inserted by the EM_INSERTIMAGE message. // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-richedit_image_parameters typedef struct // tagRICHEDIT_IMAGE_PARAMETERS { LONG xWidth; LONG yHeight; LONG Ascent; LONG Type; LPCWSTR pwszAlternateText; IStream *pIStream; } RICHEDIT_IMAGE_PARAMETERS; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit.tagRICHEDIT_IMAGE_PARAMETERS")] [StructLayout(LayoutKind.Sequential)] public struct RICHEDIT_IMAGE_PARAMETERS { /// The width, in HIMETRIC units (0.01 mm), of the image. public int xWidth; /// public int yHeight; /// /// If Type is TA_BASELINE, this parameter is the distance, in HIMETRIC units, that the top of the image extends above the /// text baseline. If Type is TA_BASELINE and ascent is zero, the bottom of the image is placed at the text baseline. /// public int Ascent; /// /// The vertical alignment of the image. It can be one of the following values. /// /// /// Value /// Meaning /// /// /// TA_BASELINE /// Align the image relative to the text baseline. /// /// /// TA_BOTTOM /// Align the bottom of the image at the bottom of the text line. /// /// /// TA_TOP /// Align the top of the image at the top of the text line /// /// /// public Gdi32.TextAlign Type; /// The alternate text for the image. [MarshalAs(UnmanagedType.LPWStr)] public string pwszAlternateText; /// The stream that contains the image data. [MarshalAs(UnmanagedType.IUnknown)] public IStream pIStream; } /// /// Contains information associated with an EN_SELCHANGE notification code. A rich edit control sends this notification to its parent /// window when the current selection changes. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-selchange typedef struct _selchange { NMHDR nmhdr; CHARRANGE // chrg; WORD seltyp; } SELCHANGE; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._selchange")] [StructLayout(LayoutKind.Sequential)] public struct SELCHANGE : INotificationInfo { /// /// Type: NMHDR /// Notification header. /// public NMHDR nmhdr; /// /// Type: CHARRANGE /// New selection range. /// public CHARRANGE chrg; /// /// Type: WORD /// /// Value specifying the contents of the new selection. This member is SEL_EMPTY if the selection is empty or one or more of the /// following values. /// /// /// /// Value /// Meaning /// /// /// SEL_TEXT /// Text. /// /// /// SEL_OBJECT /// At least one COM object. /// /// /// SEL_MULTICHAR /// More than one character of text. /// /// /// SEL_MULTIOBJECT /// More than one COM object. /// /// /// public SEL seltyp; } /// /// Specifies which code page (if any) to use in setting text, whether the text replaces all the text in the control or just the /// selection, and whether the undo state is to be preserved. This structure is used with the EM_SETTEXTEX message. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-settextex typedef struct _settextex { DWORD flags; UINT // codepage; } SETTEXTEX; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._settextex")] [StructLayout(LayoutKind.Sequential)] public struct SETTEXTEX { /// /// Type: DWORD /// Option flags. It can be any reasonable combination of the following flags. /// /// /// Value /// Meaning /// /// /// ST_DEFAULT /// Deletes the undo stack, discards rich-text formatting, replaces all text. /// /// /// ST_KEEPUNDO /// Keeps the undo stack. /// /// /// ST_SELECTION /// Replaces selection and keeps rich-text formatting. /// /// /// ST_NEWCHARS /// Act as if new characters are being entered. /// /// /// ST_UNICODE /// The text is UTF-16 (the WCHAR data type). /// /// /// public ST flags; /// /// Type: UINT /// /// The code page used to translate the text to Unicode. If codepage is 1200 (Unicode code page), no translation is done. If /// codepage is CP_ACP, the system code page is used. /// /// public uint codepage; } /// /// Defines the attributes of cells in a table row. The definitions include the corresponding Rich Text Format (RTF) control words, which /// are defined in the Rich Text Format (RTF) Specification. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-tablecellparms typedef struct _tableCellParms { LONG dxWidth; // 2 WORD nVertAlign : 2; 1 WORD fMergeTop : 1; 1 WORD fMergePrev : 1; 1 WORD fVertical : 1; 1 WORD fMergeStart : 1; 1 WORD fMergeCont : // 1; WORD wShading; SHORT dxBrdrLeft; SHORT dyBrdrTop; SHORT dxBrdrRight; SHORT dyBrdrBottom; COLORREF crBrdrLeft; COLORREF crBrdrTop; // COLORREF crBrdrRight; COLORREF crBrdrBottom; COLORREF crBackPat; COLORREF crForePat; } TABLECELLPARMS; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._tableCellParms")] [StructLayout(LayoutKind.Sequential)] public struct TABLECELLPARMS { /// /// Type: LONG /// The width of a cell (\cellx). /// public int dxWidth; private ushort flags; /// public byte nVertAlign { get => (byte)BitHelper.GetBits(flags, 0, 2); set => BitHelper.SetBits(ref flags, 0, 2, value); } /// public bool fMergeTop { get => BitHelper.GetBit(flags, 2); set => BitHelper.SetBit(ref flags, 2, value); } /// public bool fMergePrev { get => BitHelper.GetBit(flags, 3); set => BitHelper.SetBit(ref flags, 3, value); } /// public bool fVertical { get => BitHelper.GetBit(flags, 4); set => BitHelper.SetBit(ref flags, 4, value); } /// public bool fMergeStart { get => BitHelper.GetBit(flags, 5); set => BitHelper.SetBit(ref flags, 5, value); } /// public bool fMergeCont { get => BitHelper.GetBit(flags, 6); set => BitHelper.SetBit(ref flags, 6, value); } /// /// Type: WORD /// /// Shading in .01% (\clshdng). This controls the amount of pattern foreground color ( crForePat) and pattern background color /// ( crBackPat) that is used to create the cell background color. If wShading is 0, the cell background is /// crBackPat. If it's 10000, the cell background is crForePat. Values of wShading in between are mixtures of /// the two pattern colors. /// /// public ushort wShading; /// /// Type: SHORT /// Left border width, in twips (\clbrdrl\brdrwN). /// public short dxBrdrLeft; /// /// Type: SHORT /// Top border width (\clbrdrt\brdrwN). /// public short dyBrdrTop; /// /// Type: SHORT /// Right border width (\clbrdrr\brdrwN). /// public short dxBrdrRight; /// /// Type: SHORT /// Bottom border width (\clbrdrb\brdrwN). /// public short dyBrdrBottom; /// /// Type: COLORREF /// Left border color (\clbrdrl\brdrcf). /// public COLORREF crBrdrLeft; /// /// Type: COLORREF /// Top border color (\clbrdrt\brdrcf). /// public COLORREF crBrdrTop; /// /// Type: COLORREF /// Right border color (\clbrdrr\brdrcf). /// public COLORREF crBrdrRight; /// /// Type: COLORREF /// Bottom border color (\clbrdrb\brdrcf). /// public COLORREF crBrdrBottom; /// /// Type: COLORREF /// Background color (\clcbpat). /// public COLORREF crBackPat; /// /// Type: COLORREF /// Foreground color (\clcfpat). /// public COLORREF crForePat; } /// /// Defines the attributes of rows in a table. The definitions include the corresponding Rich Text Format (RTF) control words, which are /// defined in the Rich Text Format (RTF) Specification. /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-tablerowparms typedef struct _tableRowParms { BYTE cbRow; // BYTE cbCell; BYTE cCell; BYTE cRow; LONG dxCellMargin; LONG dxIndent; LONG dyHeight; 3 DWORD nAlignment : 3; 1 DWORD fRTL : 1; 1 DWORD // fKeep : 1; 1 DWORD fKeepFollow : 1; 1 DWORD fWrap : 1; 1 DWORD fIdentCells : 1; LONG cpStartRow; BYTE bTableLevel; BYTE iCell; } TABLEROWPARMS; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._tableRowParms")] [StructLayout(LayoutKind.Sequential)] public struct TABLEROWPARMS { /// /// Type: BYTE /// The count of bytes in this structure. /// public byte cbRow; /// /// Type: BYTE /// The count of bytes in TABLECELLPARMS. /// public byte cbCell; /// /// Type: BYTE /// The count of cells in a row, up to the maximum specified by MAX_TABLE_CELLS. /// public byte cCell; /// /// Type: BYTE /// The count of rows. /// public byte cRow; /// /// Type: LONG /// The size of the left and right margins in a cell (\trgaph). /// public int dxCellMargin; /// /// Type: LONG /// The amount of left indentation, or right indentation if the fRTL member is TRUE (similar to \trleft). /// public int dxIndent; /// /// Type: LONG /// The height of a row (\trrh). /// public int dyHeight; private uint flags; /// public uint nAlignment { get => (byte)BitHelper.GetBits(flags, 0, 3); set => BitHelper.SetBits(ref flags, 0, 3, value); } /// public bool fRTL { get => BitHelper.GetBit(flags, 3); set => BitHelper.SetBit(ref flags, 3, value); } /// public bool fKeep { get => BitHelper.GetBit(flags, 4); set => BitHelper.SetBit(ref flags, 4, value); } /// public bool fKeepFollow { get => BitHelper.GetBit(flags, 5); set => BitHelper.SetBit(ref flags, 5, value); } /// public bool fWrap { get => BitHelper.GetBit(flags, 6); set => BitHelper.SetBit(ref flags, 6, value); } /// public bool fIdentCells { get => BitHelper.GetBit(flags, 7); set => BitHelper.SetBit(ref flags, 7, value); } /// /// Type: LONG /// The character position that indicates where to insert table. A value of –1 indicates the character position of the selection. /// public int cpStartRow; /// /// Type: BYTE /// The table nesting level (EM_GETTABLEPARMS only). /// public byte bTableLevel; /// /// Type: BYTE /// The index of the cell to insert or delete (EM_SETTABLEPARMS only). /// public byte iCell; } /// /// A range of text from a rich edit control. This structure is filled in by the EM_GETTEXTRANGE message. The buffer pointed to by the /// lpstrText member must be large enough to receive all characters and the terminating null character. /// /// /// Note /// /// The richedit.h header defines TEXTRANGE as an alias which automatically selects the ANSI or Unicode version of this function based on /// the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral /// can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes. /// /// // https://learn.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-textrangea typedef struct _textrange { CHARRANGE chrg; LPSTR // lpstrText; } TEXTRANGEA; [PInvokeData("richedit.h", MSDNShortId = "NS:richedit._textrange")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct TEXTRANGE { /// /// Type: CHARRANGE /// The range of characters to retrieve. /// public CHARRANGE chrg; /// /// Type: LPSTR /// The text. /// [MarshalAs(UnmanagedType.LPTStr)] public string lpstrText; } }