Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Overviews
 DWM Thumbnail Overview
DWM Thumbnail Overview

A new feature enabled by Desktop Window Manager (DWM) is thumbnails of application windows. However, DWM thumbnails are not static snapshots of a window. They are dynamic, constant connections, between a thumbnail source window and a location on a destination window that receives the live thumbnail rendering. This allows a quick view of applications by hovering over the application on the tool bar or using the ALT-TAB key gesture to see and quickly switch to the applications.

The following image illustrates the Windows Vista live thumbnails when you hover over the application on the tool bar.

DWM Enabled ALT-TAB

The following image illustrates the Windows Vista Flip (ALT-TAB) enabled by DWM.

DWM Enabled ALT-TAB

Note  DWM thumbnails do not enable developers to create applications like the Windows Vista Flip3D (WINKEY-TAB) feature. Thumbnails are rendered directly to the destination window in 2-D

This topic contains the following sections:

DWM Thumbnail Relationships

To display thumbnails in your application, you must first establish a relationship between a source HWND and a destination HWND. This is done using the DwmRegisterThumbnail function.

DwmRegisterThumbnail does not render a thumbnail on the destination window but merely creates the relationship and provides the thumbnail handle. The thumbnail is rendered once the DWM_THUMBNAIL_PROPERTIES have been set and DwmUpdateThumbnailProperties has been called. Subsequent calls to DwmUpdateThumbnailProperties will update the thumbnail with a new set of properties. The DWM also provides the helper function DwmQueryThumbnailSourceSize to determine the source window size from a thumbnail to help decide on proper thumbnail properties.

To end a thumbnail relationship, call DwmUnregisterThumbnail.

The following example demonstrates how to create a releationship with the desktop and display it in an application.

   HRESULT hr = S_OK;

   //Register Thumbnail
   HTHUMBNAIL thumbnail = NULL;

   hr = DwmRegisterThumbnail(hwnd, FindWindow(_T("Progman"), NULL), &thumbnail);
   if (SUCCEEDED(hr))
   {
      //destination rectangle size
      RECT dest = {0,50,100,150};

      //Set thumbnail properties for use
      DWM_THUMBNAIL_PROPERTIES dskThumbProps;
      dskThumbProps.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_VISIBLE | DWM_TNP_SOURCECLIENTAREAONLY;
      //use window frame and client area
      dskThumbProps.fSourceClientAreaOnly = FALSE;
      dskThumbProps.fVisible = TRUE;
      dskThumbProps.opacity = (255 * 70)/100;
      dskThumbProps.rcDestination = dest;

      //display the thumbnail
      hr = DwmUpdateThumbnailProperties(thumbnail,&dskThumbProps);
      if (SUCCEEDED(hr))
      {
         //do more things
      }
   }
   return hr;	

Related Topics

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Bug in example      leehu   |   Edit   |  
The example sets "dskThumbProps.opacity" but does not specify DWM_TNP_OPACITY in dskThumbProps.dwFlags.
Tags What's this?: bug (x) example (x) Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker