Window Background

closed account (G26pX9L8)
Hello everyone,

I made a windowed application with a edit box. Now i want to change the background color of de edit box into black and set the text color to green. This is de code im using now:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
case WM_CREATE:
            CreateWindow(
                "EDIT",
                "",
                WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                hwnd,
                (HMENU)1001,
                g_hInst,
                NULL
            );
            SendDlgItemMessage(hwnd, 1001, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
        break;

Anybody an idea?
You need to handle WM_CTLCOLOREDIT message:
1
2
3
4
5
6
7
8
case WM_CTLCOLOREDIT:
{
	HDC hEdit = (HDC)wParam;

	SetTextColor( hEdit, RGB(0, 255,0) );
	SetBkColor  ( hEdit, RGB(0, 0, 0) );
	return (INT_PTR)GetStockObject( BLACK_BRUSH );
}

http://msdn.microsoft.com/en-us/library/bb761691(v=VS.85).aspx
Last edited on
closed account (G26pX9L8)
thanks for so far, i'll check if this is working :)

EDIT:
yes it works, thx
Last edited on
Topic archived. No new replies allowed.