procedure TForm1.Button1Click(Sender: TObject);
var
I, Row, Col: Integer;
S: string;
begin
S := 'aaa';
Row := 2;
Col := 3;
I := SendMessage(M.Handle, EM_LINEINDEX, Row, 0) + Col;
SendMessage(M.Handle, EM_SETSEL, I, I + Length(S));//如果插入,第二个参数也是I
SendMessage(M.Handle, EM_REPLACESEL, 1, LongInt(S));
end;