How to set background color of window after I have registered it?

Viewed 59262

I am not using a dialog, I'm using my own custom class which I have registered and then used the CreateWindow call to create it, I have preset the background color to red when registering:

WNDCLASSEX wc;
wc.hbrBackground = CreateSolidBrush(RGB(255, 0, 0));

But now I want to change the background color at runtime, by e.g. clicking a button to change it to blue.

I have tried to use SetBkColor() call in the WM_PAINT, and tried returning a brush from the WM_CTLCOLORDLG message, they don't work.

Any help?

3 Answers
Related