Give these definitions a try.
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPStr)] StringBuilder lParam);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
The reason for the FindWindowEx is so that you can find the child window that contains the text. If you use the MainWindowHandle, you will retrieve the window title. You need to find the child window whose class name is "Edit". Also give the string builder an ample initial size. The default size is 16 characters. I will leave it to you to write the logic to compare the returned number of characters against the stringbuilder's "Capacity" property to determine if you got all the text. If returned length is Capacity -1, there may be more text that you did not retrieve.
Process[] processes = Process.GetProcessesByName("notepad");
foreach (Process p in processes)
{
string myGotWindow = p.MainWindowTitle;
IntPtr pEditWindow = FindWindowEx(p.MainWindowHandle, IntPtr.Zero, "Edit", null);
const uint WM\_GETTEXT = 0x0D;
StringBuilder sb = new StringBuilder(1000);
IntPtr retVal = SendMessage(pEditWindow, WM\_GETTEXT, (IntPtr)sb.Capacity, sb);
textBox1.Text = sb.ToString();
}