在Delphi中巧用Windows 的API函数
begin
LineNum := SendMessage(Memo1.Handle,EM_LINEFROMCHAR,
Memo1.SelStart,0);
CharsBeforeLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,
LineNum,0);
Label1.Caption:='Line: '+IntToStr(LineNum + 1);
Label2.Caption:='Position: '+IntToStr((Memo1.SelStart -
CharsBeforeLine)+1);
end;
《在Delphi中巧用Windows 的API函数(第2页)》