Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
First of all, give my sincere thanks to you who pay attention to my question.
I would like to add hyperlinks in the view inherited from CRichEditView. Now i can successfully realized hypelink using code shown below.The text hypelinked can response to mouse clicks normally.
CHARFORMAT2 cf;
ZeroMemory(&cf, sizeof(CHARFORMAT2));
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_LINK;
cf.dwEffects |= CFE_LINK;
GetRichEdtiCtrl().SendMessage(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);

But, which confuses me for a long time is that: the hypelink cannot be copied or saved.That is to say, when i copy the text hypelinked and then paste,the text is non-hypelinked. I obtain the attributes of the text and list below:

non-hypelinked text
cf.dwMask ---- 4278190079 ---- 1111.1110.1111.1111.1111.1111.1111.1111
cf.dwEffects ---- 1140850688 ---- 100.0100.0000.0000.0000.0000.0000.0000

hypelinked text
cf.dwMask ---- 4278190079 ---- 1111.1110.1111.1111.1111.1111.1111.1111
cf.dwEffects ---- 1140850720 ---- 100.0100.0000.0000.0000.0000.0010.0000

the CFE_LINK bit is 0x20, CFM_LINK bit is also 0x20, which can be viewed in richedit.h

Thanks.
Posted
Updated 19-Oct-13 0:03am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900