If I change the size of a window using MoveWindow to 400x250, the entire window (including title bar and borders) is made to be 400x250. Is there any way to size it so that the actual client area is 400x250?
If I change the size of a window using MoveWindow to 400x250, the entire window (including title bar and borders) is made to be 400x250. Is there any way to size it so that the actual client area is 400x250?
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Nevermind. Figured it out.
Code:RECT rect; int borderWidth; int borderHeight; MoveWindow( g_hWnd, 100, 100, 400, 250, FALSE ); GetClientRect( g_hWnd, &rect ); borderWidth = 400 - ( rect.right - rect.left ); borderHeight = 250 - ( rect.bottom - rect.top ); MoveWindow( g_hWnd, 100, 100, WINDOW_WIDTH + borderWidth, WINDOW_HEIGHT + borderHeight, FALSE );
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Hmmmm, thanks for thinking out loud. I like your way of determining the border size
Heh. I'm sure that someone will point out a better way to do it, but that seems to be working fine for me.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
That's actually the way I always do things. Find the current client size, and use the desired client size to figure out how much to expand the window.
Check out this handy function. AdjustWindowRect( );
http://msdn.microsoft.com/library/de...WindowRect.asp
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
That method is good for sizing before the creation of the window, but I find it a pain in the ass to write down the window styles over and over.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Why not just combine them into one DWORD much like you specify when creating the window with bitwise OR.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
GetSystemMetrics() can return the thickness of the windows frame.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
>>but I find it a pain in the ass to write down the window styles over and over.
dwStyle = GetWindowLong (hWnd, GWL_STYLE);
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill