Example #1
0
        /// <summary>Get text from the rich text box</summary>
        public string GetText(int first = 0, int last = -1)
        {
            var range = new Win32.TEXTRANGE(first, last);
            var len   = SendMessage(Handle, Win32.EM_GETTEXTRANGE, 0, ref range);
            var err   = Marshal.GetLastWin32Error();

            if (err != 0)
            {
                Marshal.ThrowExceptionForHR(err);
            }
            return(range.text);
        }
Example #2
0
 [DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)] private static extern int SendMessage(IntPtr hwnd, uint msg, int wparam, ref Win32.TEXTRANGE lparam);