as I commented before, it may not give you the correct line number.
With WORDWRAP on.
If you are on the first line of the memo and you keep typing away to force it to wrap around, technically the next line is still the first line, and such the reporting index should still be 0.
Using the Sendmessage(Memo.Handle, EM_LINEFROMCHAR, -1, 0) should return the actual line index.
This only applies to windblows, unless something has changed since then.