CRichEditCtrl Problem of displaying text as hyperlink
-
I am using CChatRichEd class derived from CRichEditCtrl downloaded from codeproject to show url as hyperlink in my RichEdit control. Now when I click the url to open the respective url I am facing 3 problems. 1. I neew to click it twice although it should open on a single click. 2. Secondly On clicking the URL link and after the url gets openend if i look at the RichEdit control the cursor is at the position in the url where mouse was clicked and it blinks over as there as a result of which the next text appears at that position where the mouse was clicked. I want that the the cursor should not be displayed and blink and should move to the next line after the link. I am using the following code for opening the URL:
BOOL CChatRichEd::OnLink(NMHDR *pNotifyHeader, LRESULT *pResult)
{
ENLINK *pENLink = (ENLINK *) pNotifyHeader;
CString URL ;
CHARRANGE CharRange ;\*pResult = 0; switch (pNotifyHeader->code) { case EN\_LINK: pENLink = (ENLINK \*) pNotifyHeader; switch (pENLink->msg) { case WM\_LBUTTONDOWN: GetSel(CharRange); SetSel(pENLink->chrg); URL = GetSelText(); SetSel(CharRange); { CWaitCursor WaitCursor; ShellExecute(GetSafeHwnd(), \_T("open"), URL, NULL, NULL, SW\_SHOWNORMAL); \*pResult = 1; } break; case WM\_LBUTTONUP: \*pResult = 1; break ; } break; } return 0;
}
Please help me. Thanks Dhiraj
-
I am using CChatRichEd class derived from CRichEditCtrl downloaded from codeproject to show url as hyperlink in my RichEdit control. Now when I click the url to open the respective url I am facing 3 problems. 1. I neew to click it twice although it should open on a single click. 2. Secondly On clicking the URL link and after the url gets openend if i look at the RichEdit control the cursor is at the position in the url where mouse was clicked and it blinks over as there as a result of which the next text appears at that position where the mouse was clicked. I want that the the cursor should not be displayed and blink and should move to the next line after the link. I am using the following code for opening the URL:
BOOL CChatRichEd::OnLink(NMHDR *pNotifyHeader, LRESULT *pResult)
{
ENLINK *pENLink = (ENLINK *) pNotifyHeader;
CString URL ;
CHARRANGE CharRange ;\*pResult = 0; switch (pNotifyHeader->code) { case EN\_LINK: pENLink = (ENLINK \*) pNotifyHeader; switch (pENLink->msg) { case WM\_LBUTTONDOWN: GetSel(CharRange); SetSel(pENLink->chrg); URL = GetSelText(); SetSel(CharRange); { CWaitCursor WaitCursor; ShellExecute(GetSafeHwnd(), \_T("open"), URL, NULL, NULL, SW\_SHOWNORMAL); \*pResult = 1; } break; case WM\_LBUTTONUP: \*pResult = 1; break ; } break; } return 0;
}
Please help me. Thanks Dhiraj
Dhiraj kumar Saini wrote:
1. I neew to click it twice although it should open on a single click.
Based on what?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch