Infosys Microsoft Alliance and Solutions blog

« Visual Studio 2005 and SQL 2005 on Vista RTM | Main | BizTalk Server 2006 on Vista RTM »

Application Thumbnails in Vista

I have been using Vista for a while now (started with RC1 and upgraded to RTM recently). One of the things that one notices immediately is the cool new graphics capabilities that Vista offers. I am amazed by looking at the new set of icons also being used for various applications and the transparency that the windows now offer.

Another interesing feature is the application thumbnails that you see when you do ALT + TAB or hover the mouse over applications in the task bar. If you notice carefully these aren't static images but live previews of the application. So as the application state changes, the thumbnail updates accordingly. One simple way to verify this is the run some setup program and then watch the thumbnail by hovering the mouse over the taskbar button for that application.

I was hence interested to find out if this feature is something that we can use in our applications and it turns out that we can. This new feature is essentially by virtue of the new Desktop Windows Manager, a new component in Vista. Refer to this blog by Greg Schechter for a good overview. Read the online documentation to get insight into this new API set and how it works. You can check the Thumbnail overview for more details on that.

I also found a cool sample code on Channel 9 Forums by Sven Groot. I downloaded and used it on my Vista RTM machine and got a "stack has become unstable error". It pointed to the DwmRegisterThumbnail API to be reason for the problem. A quick look at the API signature in the online documentation showed the difference and I made changes to the NativeMethods.cs file accordingly. The size parameter is no longer used. You can edit the NativeMethods.cs file to alter the signature as below and the code should work just fine.

File NativeMethods.cs:

[DllImport("dwmapi.dll")]
public static extern int DwmRegisterThumbnail(IntPtr hwndDestination, IntPtr hwndSource, out SafeThumbnailHandle phThumbnailId);

Some more implementation samples are mentioned in this another blog post by Greg.

So go ahead, start playing around with this new API set!

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter