Here's a sample I made for someone a couple years ago. It's not exactly what you're trying to do but maybe it'll be helpful.

// Sample assumes:
//
// HDC g_hdcMem already created with CreateCompatibleDC() before subclassing the MDI window.
// Be sure to delete g_hdcMem when your application is done with it.
//
// HBITMAP g_hbmMem created/deleted when processing WM_SIZE.
//
// HFONT BigFont created before subclassing the MDI window.
//
// MDI client window subclassed. OldProc = (WNDPROC)SetWindowLong(hwndMdiClient, GWL_WNDPROC, (LONG)MdiClientProc);
//
// This sample does no error checking. Be careful.

void DoGradient(HDC hdc, int cx, int cy)
{
TRIVERTEX vert[3][2];
GRADIENT_RECT Rect;

vert[0][0].x = 0;
vert[0][0].y = 0;
vert[0][0].Red = 0x0000;
vert[0][0].Green = 0x0000;
vert[0][0].Blue = 0x0000;
vert[0][0].Alpha = 0x0000;

vert[0][1].x = cx;
vert[0][1].y = cy/2;
vert[0][1].Red = 0xdd00;
vert[0][1].Green = 0xee00;
vert[0][1].Blue = 0xff00;
vert[0][1].Alpha = 0x0000;

vert[1][0].x = 0;
vert[1][0].y = cy/2;
vert[1][0].Red = 0xdd00;
vert[1][0].Green = 0xee00;
vert[1][0].Blue = 0xff00;
vert[1][0].Alpha = 0x0000;

vert[1][1].x = cx;
vert[1][1].y = cy;
vert[1][1].Red = 0x0000;
vert[1][1].Green = 0x0000;
vert[1][1].Blue = 0x0000;
vert[1][1].Alpha = 0x0000;

vert[2][0].x = 0;
vert[2][0].y = 0;
vert[2][0].Red = 0x000;
vert[2][0].Green = 0x0000;
vert[2][0].Blue = 0x0000;
vert[2][0].Alpha = 0x0000;

vert[2][1].x = cx;
vert[2][1].y = cy;
vert[2][1].Red = 0xdd00;
vert[2][1].Green = 0xee00;
vert[2][1].Blue = 0xff00;
vert[2][1].Alpha = 0x0000;

Rect.UpperLeft = 0;
Rect.LowerRight = 1;

GradientFill(hdc, vert[0], 2, &Rect, 1, GRADIENT_FILL_RECT_V);
GradientFill(hdc, vert[1], 2, &Rect, 1, GRADIENT_FILL_RECT_V);

RECT r = {0, cy-20, cx, cy};

SelectObject(hdc, BigFont);
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, RGB(150, 175, 200));
DrawText(hdc, "My Sample", -1, &r, DT_RIGHT|DT_BOTTOM|DT_SINGLELINE);
}

LRESULT CALLBACK MdiClientProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;

switch (uMsg)
{
case WM_SIZE:
if (wParam == SIZE_MINIMIZED) break;
hdc = GetDC(hWnd);
if (g_hbmMem) DeleteObject(g_hbmMem);
g_hbmMem = CreateCompatibleBitmap(hdc, LOWORD(lParam), HIWORD(lParam));
ReleaseDC(hWnd, hdc);
SelectObject(g_hdcMem, g_hbmMem);
DoGradient(g_hdcMem, LOWORD(lParam), HIWORD(lParam));
DeleteObject(g_hbmMem);
g_hbmMem = 0;
InvalidateRect(hWnd, NULL, 0);
break;

case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
BitBlt(hdc,
ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right, ps.rcPaint.bottom,
g_hdcMem, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);
EndPaint(hWnd, &ps);
}
return 0L;

default:
return CallWindowProc(OldProc, hWnd, uMsg, wParam, lParam);
}
return CallWindowProc(OldProc, hWnd, uMsg, wParam, lParam);
}