Sunday, September 12, 2010

Vista Goodies in C++: Using Glass in Your UI

Contents
Introduction
Glass in the Aero Theme
Starting the Project
Adding Glass to the Frame
Adding Text to the Glass Area
Using the Right Font
Drawing the Text
Handling Composition-Related Notifications
Using Glass in a Dialog-Based App
Setting Up the Dialog
Enabling Glass
Drawing the Text
Drawing Graphics on Glass
Making the Entire Window Glass
Conclusion
References
Copyright and License
Revision History

Introduction
This is the first article in a series that will demonstrate how to use various new features of Vista from native C++ code. The sample code is built with Visual Studio 2005, WTL 7.5, and the Windows SDK. I've classified these articles as Intermediate because I won't be covering the basics of Win32 APIs and WTL. See my series of articles on WTL if you need to get up to speed on WTL. I also won't be going step-by-step through the Visual Studio wizards, which were also covered in the WTL series. (Those articles show the wizards in VC 2003, but the wizards in 2005 are similar.)
The Aero theme and glass effects, along with the desktop window manger (DWM), are major new features in Vista that Microsoft is pushing heavily. Here in this first article, I'll demonstrate how to use Aero glass in a frame window-based app and a dialog-based app. Incorporating glass into your app is one way to make it distinctive (and, let's face it, look cool) when the Aero theme is enabled.
Read more: Codeproject