//---------------------------------------------------------------------------------------------------- /// <summary> /// Gets the length of a control's Text. Required since using the RichTextBox.Length property wipes /// out the Undo/Redo buffer. /// </summary> /// <param name="hControl">The h control.</param> /// <returns></returns> //---------------------------------------------------------------------------------------------------- public static int GetTextLength(IntPtr hControl) { var lpGtl = new GetTextLengthEx { uiFlags = 0, uiCodePage = 1200 }; return(SendMessage(hControl, EM_GETTEXTLENGTHEX, ref lpGtl, IntPtr.Zero).ToInt32()); }
internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, ref GetTextLengthEx wParam, IntPtr lParam);