you set the size of the non-client area by handling the WM_NCCALCSIZE
message. But don't do this unless you plan to do all of the non-client drawing as well by handling WM_NCPAINT
Edit: here are two code fragments, one that handles WM_NCCALCSIZE and provides a simple n pixel border, and another than adds some extra pixels after DefWindowProc has done the default handling.
1 case WM_NCCALCSIZE: 2 { 3 lRet = 0; 4 const int cxBorder = 2; 5 const int cyBorder = 2; 6 InflateRect((LPRECT)lParam, -cxBorder, -cyBorder); 7 } 8 9 case WM_NCCALCSIZE: 10 { 11 LPNCCALCSIZE_PARAMS pncc = (LPNCCALCSIZE_PARAMS)lParam; 12 //pncc->rgrc[0] is the new rectangle 13 //pncc->rgrc[1] is the old rectangle 14 //pncc->rgrc[2] is the client rectangle 15 16 lRet = DefWindowProc (hwnd, WM_NCCALCSIZE, wParam, lParam); 17 pncc->rgrc[0].top += ExtraCaptionHeight; 18 }
You can learn a lot by passing WM_NCCALCSIZE to DefWindowProc and looking at the values of the NCCALCSIZEPARAM before and after.