This looks too complicated. I don't think you need to test actual color, it should be enough to return different stock brush from what default procedure returns.
Well, I wanted to make sure. You mean I should just compare the HBRUSH itself?
Another question is how any of this is affected by read-only switch,
Good catch, that "EM_SETREADONLY" is not needed anymore. I reworked the code, and now it's unnecessary.
and why your fix is not affected by it.
I don't really understand what you mean by that.
Regards, Fabian Maurer