I handle the WM_NCCALCSIZE message, and try to set the dest window client rect manually.
case WM_NCCALCSIZE:
{
RECT *rect = (LPRECT)lParam;
if (wParam == TRUE)
{
////缩小客户区的范围
//RECT *rect = (LPRECT)lParam;
//rect->left += 8;
//rect->right -= 8;
//rect->top += 30;
//rect->bottom = 8;
InflateRect(rect, -50, -50);
RECT dstRect = *(LPRECT)lParam;
RECT srcRect = rect[1];
rect[1] = dstRect;
rect[2] = srcRect;
//DefWindowProc(hWnd, message, wParam, lParam);
return 0;
//return WVR_REDRAW;
}
else
{
DWORD lRet = DefWindowProc(hWnd, message, wParam, lParam);
return lRet;
}
But the result is bad, 
When I resize the window the text drawn with DrawText does not get erased cleanly.
How do I erase the background completely?
The root cause here is if you changed the client size, you changed the non-client area size.
But WM_ERASEBKGND handler does only erase the client area background but not non-client area size.
So, if you changed the client size, you’ll also need to handle the WM_NCPAINT to erase the non-client area background and paint the frame with DefWindowProc.