how do i find out how thick the title bar of a window

For my form I can find the thick of my title bar Height-ClientHeight.
My question is: How do I determine the thick of title bar for a window having the handle of the window?
diandrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

diandrAuthor Commented:
Thanks for the answer. But I already answered that for the form I know: Height-ClientHeight. I need for a window that I know only the handle.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

quilleyCommented:
To be precise: Height - ClientHeight = height of title bar + height of menu bar (if any)

You can get the dimensions of various windows elements using the Windows API function GetSystemMetrics. You don't need a window object or handle because the dimensions are the same for all windows to which the element applies. For example:

GetSystemMetrics(SM_CYCAPTION) = Height, in pixels, of normal caption area

[On my system this gives 26 but Height - ClientHeight gives 34. Why that is I don't know - presumably the SM_CYCAPTION doesn't include the border around the client area.]

Below are results of calling GetSystemMetrics with various parameters on a standard XP installation:

SM_CXBORDER=1
SM_CYBORDER=1
SM_CXCURSOR=32
SM_CYCURSOR=32
SM_CXDLGFRAME=3
SM_CYDLGFRAME=3
SM_CXDOUBLECLK=4
SM_CYDOUBLECLK=4
SM_CXDRAG=4
SM_CYDRAG=4
SM_CXEDGE=2
SM_CYEDGE=2
SM_CXFIXEDFRAME=3
SM_CYFIXEDFRAME=3
SM_CXFRAME=4
SM_CYFRAME=4
SM_CXFULLSCREEN=1024
SM_CYFULLSCREEN=712
SM_CXHSCROLL=17
SM_CYHSCROLL=17
SM_CXHTHUMB=17
SM_CXICON=32
SM_CYICON=32
SM_CXICONSPACING=75
SM_CYICONSPACING=75
SM_CXMAXIMIZED=1032
SM_CYMAXIMIZED=746
SM_CXMAXTRACK=1036
SM_CYMAXTRACK=780
SM_CXMENUCHECK=13
SM_CYMENUCHECK=13
SM_CXMENUSIZE=18
SM_CYMENUSIZE=19
SM_CXMIN=123
SM_CYMIN=34
SM_CXMINIMIZED=160
SM_CYMINIMIZED=31
SM_CXMINSPACING=160
SM_CYMINSPACING=31
SM_CXMINTRACK=123
SM_CYMINTRACK=34
SM_CXSCREEN=1024
SM_CYSCREEN=768
SM_CXSIZE=25
SM_CYSIZE=25
SM_CXSIZEFRAME=4
SM_CYSIZEFRAME=4
SM_CXSMICON=16
SM_CYSMICON=16
SM_CXSMSIZE=17
SM_CYSMSIZE=17
SM_CXVSCROLL=17
SM_CYVSCROLL=17
SM_CYCAPTION=26
SM_CYMENU=20
SM_CYSMCAPTION=18
SM_CYVTHUMB=17
0
mikelittlewoodCommented:
Marking for myself to read too :o)
0
ZhaawZSoftware DeveloperCommented:
Height - ClientHeight = height of title bar + height of menu + height of borders (top and bottom)
0
ZhaawZSoftware DeveloperCommented:
var
  wnd : cardinal; // handle of window
  captHeight : integer;
...
begin
// if window is tool-window (i.e., with small caption)
if GetWindowLong(wnd, gwl_exstyle) and ws_ex_toolwindow = ws_ex_toolwindow
// then get height of tool-window caption
then captHeight := GetSystemMetrics(sm_cysmcaption)
// else get height of "standard" window caption
else captHeight := GetSystemMetrics(sm_cycaption);
end;
0
diandrAuthor Commented:
Acutally for my program I needed including the menus, so heretoread answered to what I need. Anyway to the entered question answered all.

Thanks everyone.
0
ZhaawZSoftware DeveloperCommented:
Don't forget that his sollution has also height of borders included in result
0
quilleyCommented:
@Zhaw
>Height - ClientHeight = height of title bar + height of menu + height of borders (top and bottom)
Thanks for correction.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.