::GetSystemMetrics (SM_CYBORDER)
...comes back with 1 and I know the title bar is taller than ONE pixel :/
I also tried:
RECT r; r.left = r.top = 0; r.right = r.bottom = 400; ::AdjustWindowRect (& r, WS_OVERLAPPED, FALSE); _bdW = (uword)(r.right - r.left - 400); _bdH = (uword)(r.bottom - r.top - 400);
But border w,h came back as 0.
In my WM_SIZE handler, I need to make sure the window's height changes in "steps" so, for example a whole new line of text could fit in the window with no "junky partial line space" at the bottom.
But ::MoveWindow needs the dimensions WITH the border space added in.
SOMEbody must have done this before... Thanks for any help :)
First, open the Registry Editor by pressing the Windows key, typing regedit, and pressing Enter. To make your window borders as small as possible, double-click BorderWidth and set it to 0, and then double-click PaddedBoderWidth and set it to 0. Sign out and sign back in to activate your new window border width.
Change thickness or width of the window borders To begin with, double-click on BorderWidth and change its value to say, 0. This value determines the current setting for the width of the borders around all the windows with borders that can be sized.
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 their 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); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With