In unthemed Windows, GetSystemMetrics(SM_CYCAPTION) is the height of the text in the title bar; you need to add in the size of the frame and border padding (GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYEDGE) * 2).
For themed Windows (which is the default these days), GetThemeSysSize is most likely the function you're looking for; in particular, GetThemeSysSize(SM_CXBORDER) for the border width, and GetThemeSysSize(SM_CYSIZE) + GetThemeSysSize(SM_CXPADDEDBORDER) * 2 for the title bar.
Give some flicker - but you got the titlebarheight.Couldn't this then be simply done by using a new form, give it an alpha value of 0 and doing all the stuff with it? this would at least not be visible.
Winni
Also, while not being a big problem, you should also consider than in linux one can change the style easily during runtime, meaning the size during one moment might not be the same size at another time
Allready done. Look into the code.Sure, I meant that in general, that you can't just call this function once on startup and expect the value to be constant. You need to call that function every time this is needed (probably can be cashed and only recalculated if WorkAreaRect.Height changed)
Winni
Result is 21 px .... exactly like the WINAPI ... :)