procedure TForm1.RichEdit1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mpt: TPoint;
cr, ccr: TCharRange;
i: Integer;
CharPos: TPoint;
begin
i := SendMessage(RichEdit1.Handle, EM_EXGETSEL, 0, longInt(@ccr));
mpt.x := x;
mpt.y := y;
i := SendMessage(RichEdit1.Handle, EM_CHARFROMPOS, 0, LongInt(@mpt));
cr.cpmin := i;
cr.cpMax := i;
i := SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, longInt(@cr));
CharPos.Y := SendMessage(RichEdit1.Handle, EM_EXLINEFROMCHAR, 0,
RichEdit1.SelStart);
CharPos.X := (RichEdit1.SelStart -
SendMessage(RichEdit1.Handle, EM_LINEINDEX, CharPos.Y, 0));
Inc(CharPos.Y);
Inc(CharPos.X);
Caption := Format('Line: %3d Col: %3d', [CharPos.Y, CharPos.X]);
i := SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, longInt(@ccr));
end;