Add the following to your window procedure:
Code:
case WM_CREATE:
{
hbr=CreateSolidBrush(RGB(0,255,0)); /*green */
return 0;
}
case WM_CTLCOLOEDIT: /*WM_CTLCOLORSTATIC for read only edit */
{
HDC hdc=(HDC)wParam;
SetTextColor(hdc,RGB(255,0,0)); /*red text*/
return (LRESULT)hbr; /*this brush used by system to paint control background */
}
case WM_DESTROY:
{
if (hbr)
{
DeleteObject(hbr); /*free gdi resources*/
}
}
This gets asked a lot so a board search should give further explanation/examples should you require them.
Dont' forget msdn:
WM_CTLCOLOREDIT.
edit controls.
edit: use SetBkColor or SetBkMode if you want the text background to match the control background.