I started to write an application that shows some information in title bar of an active window. There's no problem with detecting an active window, capturing window-switching, drawing (well, there is actually, partly), detecting position of titlebar, visible buttons in it (GetTitleBarInfo() does the trick) etc. But I couldn't find two things - sizes of caption buttons (I can find if those buttons are visible or not by using GetTitleBarInfo() though) and info about shadow under text in caption.
1) width of buttons in caption (exit, minimize, maximize, help - those ones)
This is needed because I'm drawing text on the right side of caption.
I found 2 ways of getting this info:
* GetSystemMetrics(sm_cxsize) and GetSystemMetrics(sm_cxsmsize) (for buttons in tool windows and in "regular" windows)
* SystemParametersInfo(spi_getnonclientmetrics, 0, @NCM, 0), where NCM is NonClientMetrics structure; in this case width of buttons is stored in NCM.iCaptionWidth and NCM.iSmCaptionWidth
I'm using SystemParametersInfo() at the moment because I need information about default caption's fonts too (which is stored in NCM).
In both cases returned value on my PC is 25. And the problem is that the real width of buttons is 21px, gap between buttons - 2px.
2) shadow of text
I get color of text by using GetSysColor(color_captiontext), but there can be also a shadow under text in caption (in default XP theme, not a classic one) . I can't manage to find how to check if this shadow is needed or not (seems to me that there isn't a shadow in classic theme). Another thing I can't find is a default color of this shadow.
Maybe there's another way to draw a custom text that looks like a text in caption? Something like DrawText() function but with ability to specify that it has to have font of standard/tool active/inactive window caption.