hyperlink in text box
-
Hi All i have a edit control, which i use to display text, within this text there is usually a web address. is it possible for me to make this a hyperlink ? or display a hyperlink within a text box ?? thanks si
Have you considered a rich-edit control?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Hi All i have a edit control, which i use to display text, within this text there is usually a web address. is it possible for me to make this a hyperlink ? or display a hyperlink within a text box ?? thanks si
-
Hi All i have a edit control, which i use to display text, within this text there is usually a web address. is it possible for me to make this a hyperlink ? or display a hyperlink within a text box ?? thanks si
As David posted earlier, you could do this with a RichEdit control.. Here's how I have done it in the past.. the example is using a RichEdit control in a dialog box..
// Inside the Init of the dialog..
unsigned mask = m_cRichEdit.GetEventMask();
m_cRichEdit.SetEventMask(mask | ENM_LINK);
m_cRichEdit.SendMessage(EM_AUTOURLDETECT,TRUE,0);// Inside WindowProc of the dialog..
if(message == WM_NOTIFY)
{
// ENABLE URL LINKS IN OUR RICH EDIT CONTROL.
if(((LPNMHDR)lParam)->code == EN_LINK)
{
ENLINK* p = (ENLINK *)lParam;
if (p->msg == WM_LBUTTONDOWN)
{
ENLINK* p = (ENLINK *)lParam;
m_cRichEdit.SendMessage(EM_EXSETSEL, 0, (LPARAM)&(p->chrg));
m_cRichEdit.SetSel(p->chrg);
CString strLink = m_cRichEdit.GetSelText();
ShellExecute(NULL, "open", strLink, NULL, NULL, SW_SHOWNORMAL);
}
}
}Don't forget to do a AfxInitRichEdit(); inside the Init of the APP.. Hope this helps, Rob Whoever said nothing's impossible never tried slamming a revolving door!