Hi,
I am trying to create a treeview control in a window that includes a toolbar and a status bar, I need to position the treeview immediately below the toolbar. In order to do this I need to calculate the height of the toolbar and used it as the Y parameter in the CreateWindowEx function that creates the Treeview. The problem is that the treeview appears on top of the toolbar covering the lower part of it. I am using the function below to calculate the height for both the toolbar and status bar to position the treeview between both of them. The calculation is correct for the status bar but something is wrong for the toolbar, that is the treeview appear immediately above the status bar but does not appear immediately below the toolbar. Below is my code:
This is the function to calculate the height for both the toolbar and the status bar:
int wndHeight (HWND hwndhgt)
{
RECT wndRect;
GetWindowRect(hwndhgt, &wndRect);
return (wndRect.bottom - wndRect.top);
}
This is the function for creating the treeview:
/* Calculate the client area of the parent window */
GetClientRect(hwnd, &rcClient);
hTreeView = CreateWindowEx(0, WC_TREEVIEW, NULL, WS_CHILD | WS_VISIBLE |WS_BORDER, 0, wndHeight(hToolBar), 200, rcClient.bottom - wndHeight (hToolBar) - wndHeight (hStatusBar), hwnd, (HMENU)IDC_TREEVIEW, GetModuleHandle(NULL), NULL);
I appreciate it if anybody can tell me what is wrong.
Thank you in advance.