With C++ Builder, you access the system clipboard via a TClipboard object. I decided I wanted to be able to copy-paste between my editor and Excel or Notepad and so on, so I'm copying the cell IDs as a text buffer of numbers seperated by tabs and "\r\n" sequences.
First problem is that while TClipboard provides GetTextBuf and SetTextBuf methods, there doesn't appear to be a way of finding out how big the text data in the clipboard is. I've just had to allocate a massive buffer on the heap to copy into but there is no way of detecting that the data was too big for the buffer. Perhaps there is a way of doing this by abandoning TClipboard and using the Win32 API directly, but I can't be bothered.
The other problem is that I can't seem to think of a way of differentiating between text data on the clipboard that is compatible with my editor, and any other text. Means if you copy some normal text then do paste in my level editor, you get some quite strange results.
Never mind. I can't imagine that any one else would ever use my level editor anyway so I don't know why I've just spend three hours making the copy-paste compatible with Excel. I just thought it would be cool.