views:

378

answers:

3

I really like when you hover over a window in Vista on the taskbar and it gives you a little preview. if it is video it even plays in the thumbnail.

Often I really wish I could 'tear off' this little window and keep it as an 'always on top' thumbnail on my screen. Maybe its a progress bar I'm watching, maybe its a video i want a little tiny preview of.

Isn't this the kind of thing that DWM makes it easy to program. Would this be a simple endeavor to program in nice managed C# - or would i end up getting all bogged down in tricky API stuff?

I am interested in both existing solutions and pointers on how to code something like this.

+1  A: 

Yes, you can create your own taskbar-like thumbnails. You're going to have to do quite a bit of window handle manipulation though. How it works is basically that you create a child-window in your form that will be the thumbnail. You obtian the window handle of the top-level window you want a thumbnail of using the usual tricks. Then you call a DWM function DWMRegisterThumbnail to associate the two. You don't actually get involved in painting the thumbnail at all - once the windows are associated, the DWM compositing process takes care of painting a thumbnail of the top-level window in your form.

MSDN Documentation

U62
A: 

A very good preview of how to use this in C#:

http://community.bartdesmet.net/blogs/bart/archive/2006/10/05/4495.aspx

Wolf5
exactly what i wanted. thanks!
Simon_Weaver
+1  A: 

Sorry for the self-promotion here. :) Just mentioning there's already an app that allows you to clone every top-level window and keep their preview "always on top": OnTopReplica.

The program is based on the Windows Forms Aero library, a .NET (c#) library that includes some DWM wrappers. No tricky API stuff needed (besides, the API is pretty simple anyway).

Lck
very cool thanks
Simon_Weaver