I've intercepted the WM_PAINT message for my edit control, and I am drawing my own text in. After drawing, I validate and return 0. However, when I click on the control, it erases everything I've done. Using Spy++ I can see that there are no paint or erase background messages being sent. How is it possible then for drawing to occur that I do not know about?
I gather you are subclassing the text control. One of the other messages must be causing an internal repaint.
EM_SETRECT seems to be one such. Have a look here:
Also EM_SETFOCUS seems to be a likely candidate.
Which features are you hoping to use from the original edit control? If you want the text handling ability (EM_SETSEL, EM_PASTE, etc) you will need to query the edit control for the text to paint. If you don't want these features you may be better off creating a new control.
Yeah, you're right. I would have thought that WM_PAINT would be the only drawing message, but plenty of others draw as well. If I really need to, I'll eventually create my own control. For now, I'll start a new thread to try find another solution to what I want to do.