views:

123

answers:

1

I am using MS TextServices to implement windowless rich text editing and setting CFE_LINK to create hyperlinks. This all works but when I save the text to my internal buffer for writing to a file the CFE_LINK effect isn't saved.

I have (tried to) ensured that AutoDetectURL is OFF.

I am using EM_STREAMOUT to save from editor to buffer, as UTF-8 as RichEdit doesn't seem to work with Unicode.

I've looked at the saved RTF and looked at the MS RTF Specs and I can't see what control word would be used, so now I am worrying that it's not actually saved.

+1  A: 

From my experience, the answer seems to be No. The richedit control creates the hyperlink formatting on the fly, but does not store it.

Six years ago or so I spent a lot of time trying to achieve what you are probably trying to do, using riched20.dll (at the time, version 3 of the richedit control). I wanted to have "proper" hyperlinks in a notebook application: the url would be marked as hidden text, while the description text would be underlined and clickable. The best I could do was to achieve this at runtime, marking arbitrary stretches of text with CFE_LINK. After saving and reloading the rtf stream, the changes would be gone. No amount of asking around did any good, either, though that was well before StackOverflow :)

My solution would be to replace richedit with a third-party control, such as TRichView, which can do what you want.

moodforaday
Thanks for the answer. I will look at TRichView but if it descends from TWinControl then it's not going to work for me.
blue painted