Here we interrogate the Windows API to ascertain the total number of
characters in the previous lines of a RichEdit component -note that the
i variable is an integer value for the current line...
previousChars := SendMessage(REForm.RichEdit.Handle, EM_LINEINDEX, i, 0);
Note that SendMessage() is an API function, not a function built in to Delphi,
and if we use Delphi Help to tell us about SendMessage, the information we
get is actually from the Windows API Help system...