Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the ground Glass effect in C++ language

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I would like to talk to you about how to achieve the ground glass effect in C++ language, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something from this article.

In Windows Vista-based ordinary Windows applications and dialog programs, how to use C++ language to generate Aero ground glass effect, here is the Beta 2 version of Vista and Windows SDK, now let you see the shocking effect.

Some API will change in detail. In addition, MFC is not used in this article, all the examples are generated in WTL 7.5, which can be downloaded from http://wtl.sourceforge.net/. Although Visual C++ 2003 is used here, Visual C++ 2005 is similar.

Aero theme and ground glass effect is a new feature along with Vista "Desktop window Governance (DWM)". It is also a focus of Microsoft marketing, integrating ground glass effect in the application, when opening the Aero theme, the program will look very different-cool, right?

Ground glass effect in Aero theme

When Aero is used as the theme, Vista determines whether the frosted glass effect is turned on based on the computer graphics card, and the desktop is drawn by DWM, while DWM uses a composition process to render the desktop, which automatically uses Aero theme elements (somewhat similar to Windows XP) in the non-client area of the top-level window. Then again, these ground glass effects are not always added. If the computer runs in "battery mode" or the user decides to turn off the transparency effect, then there will be no ground glass effect in the non-client area, as shown in the following figure.

If the transparent glass effect is turned on in the visual effect of the control panel, the non-client area looks like this:

Notice that the border of the notepad is green, which is the color of the wallpaper, and you can also see some icons on the desktop through the title bar. When we write code, the key is to pay attention to whether composition is turned on, not what ground glass effect is set, because DWM will deal with the part of ground glass effect drawn.

Project start

The * sample programs are SDI applications without view windows, toolbars, and status bars. After running WTL AppWizard, the * thing is to set up # define in stdafx.h to take advantage of the new features of Vista. The Windows version of Vista is 6, and the version of IE in Vista is 7. After setting up, it should look like the following:

The conversion in GetThemeTextMetrics () API is a correction to the error in Platform SDK's uxtheme.h, however, Windows SDK does not have this error, so this transformation results in an error that deletes the transformation in the function, as do the other three. Add the frosted glass effect of the border.

After reading the above, do you have any further understanding of how to realize the ground glass effect in C++ language? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report