How can I get the value of the URL the user clicked on with tRichMemo? I searched the forums, and the most relevant post ended with (oh, I used htmlviewer which isn't useful for this app).
Like this : This is just one line. And some text here
http://www.google.com is a link.
If I click on any part of the htt...e.com then I want to be able to figure out the entire clicked-on URL.
Using tRichMemo, I have enabled URL formatting but want to find a way to figure out WHAT URL the user CLICKED on (when they click on any).
Ideally, I wish to be able to have CONTROL+left-click open the URL. But even just getting the clicked on URL (EM_AUTOURLDETECT'ed ) text would be just as useful.
This is what I used to enable the formatting :
CONST ENM_LINK = $04000000;
EM_AUTOURLDETECT = WM_USER + 91;
procedure tfrmMain.tstBtnClick(Sender: TObject);
VAR mask : Word;
begin
mask := SendMessage( rtfMemo.Handle, EM_GETEVENTMASK, 0, 0);
SendMessage( rtfMemo.Handle, EM_SETEVENTMASK, 0, mask or ENM_LINK);
SendMessage( rtfMemo.Handle, EM_AUTOURLDETECT, Integer(True), 0);
Ideally, it'd be in onMouseDown so I can check ssCtrl in ShiftState but I would appreciate ANY way of getting the clicked-on URL.