   how toolbar & menu & statusbar change the client area? (win32)
  When adding a toolbar or menu or status bar, or docking a floating pane to a window, the client area of this window will be changed. why?I want to write my own docking pane in win32 api, and then set the ClientRect of the parent window, to not contain the docking pane.[Edited by - michaelj on June 12, 2006 2:28:50 AM]
  That's the way that Windows works. No windows are drawn in another window's non-client (border and titlebar) area.Typically what's done is another child window is created that is a sibling to the other "bar" windows and that's the window that the app treats as its main drawing window, so that it can draw into that window's entire client area without having to worry about drawing "around", or clipping, its siblings.;  I also forgot to mention that you can respond to the WM_NCCALCSIZE msg with a WVR_VALIDRECTS return code to give the window's client area a non-standard location and size within the window itself. But I don't think this is of value to you in your present situation.;Quote:Original post by michaeljWhen adding a toolbar or menu or status bar, or docking a floating pane to a window, the client area of this window will be changed. why?last i checked for Win32 when you add a common control toolbar or status bar to a window the client area of the parent doesn't change. now a menu yes, because it's considered to be part of the non-client area.   ;Quote:Original post by yadangoQuote:Original post by michaeljWhen adding a toolbar or menu or status bar, or docking a floating pane to a window, the client area of this window will be changed. why?last i checked for Win32 when you add a common control toolbar or status bar to a window the client area of the parent doesn't change. now a menu yes, because it's considered to be part of the non-client area.I put menu, toolbar, and statusbar to the program and then call:GetClientRect(▭);dc.Rectangle(▭);, and the rectangle draw around the whole client area. This means the toolbar & statusbar & menu have change the client area!You may have a try to see the result.So I wonder how to change the client area when I add a dialog pane to the sides of a window? Or else the main window would still update its entire window when haing a wm_paint message, inlcuding those sides areas that were docked by dialog panes.   ;Quote:Original post by Anonymous PosterI also forgot to mention that you can respond to the WM_NCCALCSIZE msg with a WVR_VALIDRECTS return code to give the window's client area a non-standard location and size within the window itself. But I don't think this is of value to you in your present situation.It works!!!But there are some problems when wParam is TRUE:case WM_NCCALCSIZE:{if(wParam){NCCALCSIZE_PARAMS* ncsp = (NCCALCSIZE_PARAMS*)(&lParam);RECT* pr = ncsp->rgrc;pr+=2;//pr++;pr->top-=100;pr->left-=100;return WVR_VALIDRECTS;}else{RECT* rect = (RECT*)lParam;rect->left+=50;rect->top+=50;return DefWindowProc(hWnd, message, wParam, lParam);}}break;When I resize the window, the whole window will be painted white.;  I did a deeper study on it, and found it not fit MSDN's explaination!MSDN:**************************If wParam is TRUE, lParam points to an NCCALCSIZE_PARAMS structure that contains information an application can use to calculate the new size and position of the client rectangle. **************************I did the following:************************case WM_NCCALCSIZE:{if(wParam){NCCALCSIZE_PARAMS* ncsp = (NCCALCSIZE_PARAMS*)(&lParam);RECT* pr0 = ncsp->rgrc;************************and I watch the memory of variable pr, it's a RECT type, but its values are too big or negative, which make me think that it's a wrong thing!:pr0{top=4265026 bottom=0 left=1242588 right=-591746099}tagRECT &;  You've got a small error:NCCALCSIZE_PARAMS* ncsp = (NCCALCSIZE_PARAMS*)(&lParam);should be:NCCALCSIZE_PARAMS* ncsp = (NCCALCSIZE_PARAMS*)lParam;No dereferencing needed.;  how careful you are!!how careless I am!!!!!!!!!!!!!!!!!!!!!!!!Really appreciate, Endurion!   