- Code: Select all
unsigned masktxt = SendMessage(redText->Handle, EM_GETEVENTMASK, 0, 0);
SendMessage(redText->Handle, EM_SETEVENTMASK, 0, masktxt | ENM_LINK);
SendMessage(redText->Handle, EM_AUTOURLDETECT, true, 0);
and
- Code: Select all
void __fastcall TMainForm::WndProc(Messages::TMessage &Message) {
if (Message.Msg == WM_NOTIFY) {
if (((LPNMHDR) Message.LParam)->code == EN_LINK) {
ENLINK *p = (ENLINK*) Message.LParam;
if (p->msg == WM_LBUTTONDOWN) {
ShowMessage("I'm here!");
SendMessage(redText->Handle, EM_EXSETSEL, 0, (LPARAM) &(p->chrg));
ShellExecute(Handle, "open", redText->SelText.c_str(), 0, 0, SW_SHOWNORMAL);
}
}
}
TForm::WndProc(Message);
}
The hyperlinks display correctly and when I put the mouse over the link the cursor changes to a hand point as it should. But when I click, nothing happens. As per the code above, the message "I'm here!" should display, but it does not. For some reason no message seem to be sent that the hyperlink is clicked. Does anybody have any idea what could be going on?
When I put the code in a separate test app with just a the TRichEdit component, everything works fine, so I am worried there is something prevent my app from working as intended but I cannot understand what that could be.