Set the SetEventMask for your m_MyRichEdit (this is my control variable for the CRichEditCtrl class) to understand links
m_MyRichEdit.SetEventMask( \Now, add a override function for OnNotify in your class. In the .h file, add
m_MyRichEdit.GetEventMask() | ENM_MOUSEEVENTS)
afx_msg BOOL OnNotify (WPARAM wParam, \Add the corresponding function similar to the one below
LPARAM lParam, LRESULT *pResult);
BOOL CParentDlg:: OnNotify (WPARAM wParam, LPARAM lParam, LRESULT * pResult)Now, your szLinkString will have the data you need to manipulate. You can use this with the ShellExecute function to popup whatever you want.
{
if (LOWORD (wParam) == IDC_RICHEDIT)
{
MSGFILTER * mf = (MSGFILTER *) lParam;
switch (mf-> msg)
{
case WM_LBUTTONUP:
ENLINK *p_EnLink;
p_EnLink = (ENLINK *)lParam;
m_MyRichEdit.SetSel (p_EnLink->chrg);
CString szLinkString = m_RichEdit.GetSelText ();
break;
)
)
return CDialog:: OnNotify (wParam, lParam, pResult);
)
On, by the way, you need to add RTF content if you intend to make that identifiable. It goes something like
CString szT = "{\\rtf1 \\par http " + szAppendString + " \\par}";My above code will popup a http link using which I Open it in ShellExecute
No comments:
Post a Comment