I want to copy the content of a richedit control to a buffer.You know the text in the richedit have format.I want to copy both the text and its format.

First I need to allocate the buffer,so I need to know the size of the formatted text.I know I can use the GetWindowText() to get the text length.But it's only the text length,I need to get the format data length also.I failed to find such a function which can help me getting the data size.

How can I get the size?

If it's impossible,maybe I'll save the formatted text to a RTF file first and then get its length as the size of my buffer.It's not a good way.So I wish your help.