Home | About | Search | RikReader
DWM Thumbnails in WPF

After reading a post on the MSDN Forums I finally came to understand what the DWM Thumbnail API is all about. Basically, it allows you to request the Vista DWM to paint a Thumbnail of another application over your own. The DWMAPI won't let you write a Flip 3D, but Flip 2D and Exposé (as shown here) are within reach.

Unfortunately V1 of WPF wont provide any native support for DWM Thumbnails, but that doesn't stop us from using the API though PInvoke. I put together an element which when passed a Window Handle pulls in the DWM Thumbnail and sizes appropriately. It has basically the same restrictions as hosting Windows Forms: no visual brush, airspace issues, only uniform scale transforms will work correctlly. I currently don't pay any attention to the desktop DPI setting, and if the source of the Thumbnail changes size this wont be picked up correctly until the next WPF Measure/Arrange.

But with all that said, click here to download a quick demo, click "Refresh" to populate an ItemsControl with thumbnails from your currently running applications.

[Download the Visual Studio Project]
[Download the Sample Executable (Windows Vista RC1 or higher)]

Update: I posted an overview of the source code here.

  • Windows Presentation Foundataion