My program needs to read text from a RichEdit control in another windows
application. All I have is the Handle of the RichEdit control.

So first I tried:
lResult = SendMessage( hwnd, WM_GETTEXT, 5000, (long)bufferBig);

This works, however the size of the text in the RichEdit may exceed 64k, also
I prefer not to read the whole text everytime for performance reasons,
therefore I try to use the messages for the RichEdit control, for example:
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &crange);
or
lResult = SendMessage( hwnd, EM_EXSETSEL, 0, (long)(&crange) );
or
lResult = SendMessage( hwnd, EM_GETSELTEXT, 0, (long)bufferBig );

crange and bufferBig are defined and initiated properly.

When I have any of the above in my program, the program that includes the
RichEdit control will crash.

Does anyone know what is the problem? Any workaround to get the data over 64k
?

Thanks in advance!