Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 951
Mark Ingram Avatar asked Jan 26 '09 10:01

Mark Ingram


People also ask

How do I change the caption buttons in Windows 10?

To define how the captions appear in Windows and some Windows apps, you can select one of the predefined caption options or customize an option to better suit your needs. Select (Start) > Settings > Accessibility > Captions.

What part of screen element that minimizes maximizes restores and closes the window?

Title bars contain at least three small buttons that minimize, maximize or restore, and close the window associated with the title bar. Title bars also contain a context-sensitive Help button.


1 Answers

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

like image 186
Mark Ingram Avatar answered Nov 15 '22 21:11

Mark Ingram