First, this code has a resource leak. You are supposed to return the
handle of brush that you own. You above code returns a brand new
brush each time!
The system DOES NOT delete the brush you return from this message, it
simply uses it. You are supposed to allocate the brush *once* and
return its handle for each message. When the window goes away, you
delete the brush. If you get a WM_SYSCOLORCHANGE, you may need to
destroy and current brush and allocate the new one. The point is,
the system does not assume ownership of the brush and code like what
you show above is "throwing away" a brush each time the edit window
paints (at least).