Whistler User Experience


This is preliminary documentation and is subject to change.

The User Experience controls are a new control set based on the Microsoft® Win32® common controls and user controls. This control set has a new functionality, referred to as themes. The look and feel of theme-aware controls can change based on the selected system themes.

The following topics are discussed in this article.

What are themes?

You can take advantage of theme capability and produce controls that query the system for theme information. Based on the specifications of a theme, the system displays different visual appearances. Using the User Experience controls makes your application theme-aware; therefore you can tailor your application's appearance to suit your audience. For example, the business and consumer releases of Whistler could implement themes to produce different user interfaces to distinguish the two products. The Microsoft® Windows® 2000 Appearance dialog in display settings allows the user to change colors, fonts, and sizes of selected desktop elements. The User Experience controls provide even more control over the desktop. They enable the system to make changes to any theme-aware control or window.

Why use themes?

The User Experience Theme library, or UxTheme.lib, is a rendering library that separates the visual element of a control from its functionality. Using this library, a control can retrieve its appearance from the current system theme without you writing specialized code.

UxTheme.lib is used by the new Common Controls to take advantage of system themes. ComCtl32.dll, version 6, queries UxTheme.lib for appropriate dimensions, sizes, and other pertinent information about a control. The dynamic-link library (DLL) calls the UxTheme library to render the parts of a control or surface. Using UxTheme, you can define the rendering of icons, borders, controls, and other user interface (UI) elements.

How do I use themes?

To use themes in your application take the following steps:

  1. Author a theme-aware control.
  2. Add a schema to describe the parts of the control displayed in specified states.
  3. Make the control code theme-aware by:
    • Retrieving the HTHEME handle with OpenThemeData
    • Calling the UxTheme functions to draw elements such as background, text, and lines.
    • Writing controls that use the DrawThemeXXX functions for rendering.
      Important  Use the lower level functions, such as GetThemeXXX, only when higher lever functions do not suffice.
    • Including code to provide backup drawing when HTHEME=NULL.
  4. To change the theme, the system enumerates the installed themes, selects the appropriate one, and loads it.
  5. To load a theme, the theme loader does the following:
    • Loads the theme information, if available and valid, from the cache.
    • Parses the theme files.
    • Writes data to a shared memory map file.
    • Sends WM_THEMECHANGED message to all windows.
  6. All applications have nonclient area and dialog background theme support, by default. Applications that are linked to ComCtl32.dll, version 6, will have their standard and common controls made theme-aware.
  7. When themes are used with a control the following occurs:
    • The control receives a WM_THEMECHANGED message.
    • If HTHEME is not NULL, drawing functions draw the control parts such as the background and text.

User Experience Theme API

The UxTheme API provides functions for opening and closing the theme data files, as well as a number of drawing and measuring functions. For the UxTheme reference, see User Experience Themes and Controls Reference



© 2000 Microsoft Corporation. All rights reserved. Terms of use.