public static string GetText(RichTextBox rt) { int iCharLength = GetTextLength(rt) + 1; int iByteLength = 2 * iCharLength; GETTEXTEX GT = new GETTEXTEX(); GT.iCb = iByteLength; GT.iFlags = GT_DEFAULT; GT.iCodepage = CP_UNICODE; StringBuilder SB = new StringBuilder(iCharLength); SendMessage(rt.Handle, EM_GETTEXTEX, ref GT, SB); string strText = SB.ToString(); return(strText); }
private static extern int SendMessage(IntPtr hWnd, int Msg, ref GETTEXTEX wParam, StringBuilder lParam);
public static string GetText(RichTextBox rt) { int iCharLength = GetTextLength(rt) + 1; int iByteLength = 2 * iCharLength; GETTEXTEX GT = new GETTEXTEX(); GT.iCb = iByteLength; GT.iFlags = GT_DEFAULT; GT.iCodepage = CP_UNICODE; StringBuilder SB = new StringBuilder(iCharLength); SendMessage(rt.Handle, EM_GETTEXTEX, ref GT, SB); string strText = SB.ToString(); return strText; }
internal static extern int SendMessage(IntPtr hWnd, int msg, ref GETTEXTEX wParam, System.Text.StringBuilder lParam);
private static extern int SendMessage(IntPtr hWnd, int msg, ref GETTEXTEX wParam, StringBuilder lParam);
public static extern int GetText(IntPtr hWnd, int Msg, ref GETTEXTEX wParam, StringBuilder lParam);
private static extern void RichTextBox_GetTextEx(out GETTEXTEX value);