I added a toolbar to the top of my window. Now the top portion of my client area is covered by the toolbar. How do I change the client area size?
Similar question about adding a status bar that covers the bottom of the client area.

Thank you,
Novice Assembler (Programmer)
Posted on 2003-03-13 19:39:10 by VVV
Use SetWindowPos to move your child windows down (use the SWP_NOSIZE or SWP_NOZORDER flag). Get the top of the child windows using GetWindowRect and add the height of the toolbar to the tops of each of the children using a enumchildwindows proc and add it to the height of your parent window. There might be an easier way but this one springs to mind. i.e.
AdjustWindow proc


invoke GetClientRect,hToolBar,lpRECT
mov eax,lpRECT.bottom
mov HeightOfTB,eax

invoke GetWindowRect,hParent,lpRECT
add lpRECT.bottom, HeightOfTB
invoke SetWindowPos, hParent, NULL, lpRECT.left, lpRECT.top, lpRECT.right, lpRECT.bottom, SWP_NOZORDER
invoke EnumChildWindows,hParent,ADDR EnumChildProc,HeightOfTB
AdjustWindow endp

EnumChildProc proc hWnd:HWND,lParam:LPARAM

invoke GetWindowRect,hWnd,ADDR lpRECT
invoke GetParent,hWnd
mov hcParent,eax
invoke ScreenToClient,hcParent,ADDR lpRECT
add lpRECT.top, lParam
invoke SetWindowPos,hWnd, NULL, lpRECT.left, lpRECT.top, 0, 0, SWP_NOSIZE or SWP_NOZORDER
EnumChildProc endp
BTW I haven't tested this so it might need a little tweaking

Posted on 2003-03-13 21:24:54 by donkey
Hi, Donkey,

Actually I don't have any child windows. Please take a look at the screen shot in attachment. Note how the text at the top and bottom is covered by stoolbar/ status bar and how the vertical scroll bar covers part of the toolbar. It doesn't start from under the toolbar and it doesn't end above the status bar.

That is why I think changing the size of the client area would solve the problem, but I don't know how to do it.

Posted on 2003-03-29 20:19:19 by VVV