Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting if Aero Glass theme is enabled?

Status
Not open for further replies.

Vachaun22

Programmer
Oct 7, 2003
171
US
Is there a way to detect if Aero glass themes are enabled on Vista/7?

It seems that windows reports sizes with GetWindowRect/DwmGetWindowAttribute incorrectly when glass themes are enabled (off by about 5 pixels).

I have been looking, and all suggestions say to check if composition is enabled, but that doesn't fully answer the question. It is possible to have composition enabled and still run either Windows Vista/7 Basic theme or Windows Classic theme. However, with these themes applied, GetWindowRect returns the true window size.

I need to offset my rect by 5 pixels *only* when the Glass themes are enabled.
 
Nevermind.

I dumbly checking the return value for the function, not the parameter passed in that gets updated to reflect the status.

 
At a guess it is the border padding. You probably need to subtract the border padding x2 from the width and height or just border padding from x and y.

Have you tried changing the Border Padding to 10 to see if your 5 pixel offset still works? The default Border Padding is 5. This is hidden in Personalization/Window Color on Vista/7.
 
Indeed xwb you are correct.

I ended up checking if compositing was enabled, and checking the registry for the PaddedBorderWidth value and adjusting the offsets based on this value rather than setting a default and allowing the value to be changed manually.

Thanks for the tip.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top