Detecting paste operation in Richtext control

Apr 09
2014

Today, I had the need to intercept the paste of text in a RTF control to remove some formattings (font type and size).

Unfortunately the Richtext control is a special beast, and this is not possible before Windows 8.

On Windows 8, EN_CLIPFORMAT message is sent to the owner window, but unfortunately at this moment there is no way to do this on versions before (I need Windows 7 support). More informations you can find on stackoverflow.com:

http://stackoverflow.com/questions/5618162/detecting-if-paste-event-occurred-inside-a-rich-text-box

My (not perfect) solution consists in a extra context menu on the control that calls my own Paste method.

Comments are closed.