I think what you're looking for is SM_CYCAPTION
-- that's the height of the title bar. SM_CYBORDER
is the height of the horizontal edges of a window.
Head Geek
2009-01-10 18:26:58
I think what you're looking for is SM_CYCAPTION
-- that's the height of the title bar. SM_CYBORDER
is the height of the horizontal edges of a window.
Head Geek gives the detailed answer: use GetSystemMetrics to add up the caption and border bits. You can also do a difference on width/height between the GetWindowRect and GetClientRect. This will give you the total of all captions/borders/etc.
The GetWindowRect and GetClientRect functions can be used calculate the size of all the window borders.
Suite101 has a article on resizing a window and the keeping client area at a know size.
Here is there sample code:
void ClientResize(HWND hWnd, int nWidth, int nHeight)
{
RECT rcClient, rcWind;
POINT ptDiff;
GetClientRect(hWnd, &rcClient);
GetWindowRect(hWnd, &rcWind);
ptDiff.x = (rcWind.right - rcWind.left) - rcClient.right;
ptDiff.y = (rcWind.bottom - rcWind.top) - rcClient.bottom;
MoveWindow(hWnd,rcWind.left, rcWind.top, nWidth + ptDiff.x, nHeight + ptDiff.y, TRUE);
}
Read MSDN and Google Groups for so basic questions answered thousands of times. (and the ClientResize has no sense...)