这个例子可能会有所帮助:
WNDCLASS wc = { 0 } ( or WNDCLASS wc; memset(&wc, 0, sizeof(wc)); )
...
...
...
wc.hbrBackground = CreateSolidBrush(0x000000ff);
...
...
RegisterClass(&wc);
LRESULT CALLBACK YourWndProc(HWND hwnd, UINT umsg, WPARAM,LPARAM)
{
switch( umsg )
{
case WM_ERASEBKGND:
{
RECT rc;
GetClientRect(hwnd, &rc);
SetBkColor((HDC)wParam, 0x000000ff);
ExtTextOut((HDC)wParam, 0, 0, ETO_OPAQUE, &rc, 0, 0, 0);
return 1;
}
case WM_PAINT:
{
PAINTSTRUCT ps;
RECT rc;
HDC hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc);
SetBkColor(hdc, 0x000000ff);
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, 0, 0, 0);
EndPaint(hwnd, &ps);
break;
}
...
...
...
default:
return DefWindowProc(...);
}
return 0;
}