none
MFC Hypelink, CFE_LINK effect cannot be copied or saved RRS feed

  • 问题

  • I am using VC6.0, Richedit version is 5.0. 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.

    2013年10月19日 10:55

答案