Click here to Skip to main content
15,668,646 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Are there a functions for determining the size of a window's tittle bar and a windows border?

For good reasons I am creating some kind of Modal dialogue boxes with split two panes, however I am facing difficulty calculation the coordinates of each pane.

I used GetClientRect and GetWindowRect but there is a slight shift because the title bar is much wider than the border.

So, does such functions exist?

This is a part of "system metrics". The application does not decide what are they, they are system-wide. Please see:[^].

If you want to change it for a single application, the solution could be: define a windows class without any non-client areas at all, and simulate these areas in a client area, or just set the style for a single window using the function SetWindowLong:[^],[^].

You would need to use the index GWL_STYLE and set style without a title bar (WS_CAPTION) and without any borders or frames (see other bits of the style value).

Share this answer
The code below would work. And please explain yourself.

RECT rc1, rc2;
int barWidth, titlebarHeight;
wchar_t a[10];
GetClientRect(hWnd, &rc1);
GetWindowRect(hWnd, &rc2);
wsprintf(a, L"%d",  titlebarHeight);
MessageBox(hWnd, a, L"Whatever", MB_OK);
Share this answer
Gbenbam 29-Dec-14 18:33pm    
Just what I needed.Thanks.
Mohibur Rashid 29-Dec-14 23:46pm    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900