How to get size and position of window caption buttons (minimise, restore, close)

Mark Ingram picture Mark Ingram · Jan 26, 2009 · Viewed 8.9k times · Source

Is there an API call to determine the size and position of window caption buttons? I'm trying to draw vista-style caption buttons onto an owner drawn window. I'm dealing with c/c++/mfc.

Edit: Does anyone have a code example to draw the close button?

Answer

Mark Ingram picture Mark Ingram · Jan 26, 2009

I've found the function required to get the position of the buttons in vista: WM_GETTITLEBARINFOEX

This link also shows the system metrics required to get all the spacing correct (shame it's not a full dialog picture though). This works perfectly in Vista, and mostly in XP (in XP there is slightly too much of a gap between the buttons).

From http://shellrevealed.com/photos/blog_images/images/4538/original.aspx