Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

modifying window caption, getting default settings of caption's stuff

Avatar of ZhaawZ
ZhaawZFlag for Latvia asked on
Delphi
8 Comments1 Solution1113 ViewsLast Modified:
Hi there!

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.
ASKER CERTIFIED SOLUTION
Avatar of DarthMod
DarthModFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers