It works for me with CFE_UNDERLINE (also bUnderlineColor for just the line color) :
CRichEdit control Hyperlink color change not working
Harsh Shankar
0
Reputation points
I have derived a class from CRichEdit and the control contains multiple hyperlinks. While every thing works as expected, customer wants to change the color of the hyperlinks to red. I tried many things, yet the hyperlink still shows in blue color. Here is the code that fails:
for (int nLstCnt = 0; nLstCnt < nListCount; nLstCnt++)
{
MESSAGELIST& objMsgList = m_arrMessageList[nLstCnt];
SetSel(objMsgList.nStartPos + 1, objMsgList.nStartPos + objMsgList.strFormatString.GetLength() - 1);
CHARFORMAT2 cf;
memset(&cf, 0, sizeof(CHARFORMAT2));
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_LINK | CFM_COLOR;
cf.dwEffects = CFE_LINK;
cf.crTextColor = RGB(0xFF, 0x00, 0x00);
SetSelectionCharFormat(cf);
}
It feels like if I use CFM_LINK, CFM_COLOR does not work. Do I am missing something? Any help will be appreciated.