Search code examples
c++winapicomole

How to implement Outlook Express alike address field control


I was thinking about inserting some object (button, panel or static text) into textctrl, like Outlook Express does this.

alt text

You can see from a pic "group1" is an object, you can double click on it, when you delete it, it gets deleted the whole text not just a part of it. I made some research and this text field is just a simple RichEdit20W. I understand that I can do it by implementing some logic to a text field and so on, but it will not be proper way of doing it. I wonder how they done that. Should I implement IRichEditOleCallback interface to achieve that? I will appreciate your answer very much. Thanks!


Solution

  • The ability to insert an object is built-in to the RichEdit control, that's what Outlook is using, and you can do the same yourself. It seems you would need to implement your own OLE object for your own item, and then use the RichEdit's COM interface to insert it. You can see a sample on MSDN that gets the COM interface and inserts an object here.