Most developers often have many windows open at once, and so often will use a virtual desktop program to help organize their windows. However, most virtual desktop software is ugly and lacks many useful features. While I don't put every feature you may want in this program, I do give a powerful base implementation of a Vista thumbnail-enhanced virtual desktop program.
How to Use the Program
Obviously, you need Windows Vista to use this program. It was tested on RC1, and some older versions have differing thumbnail API functions that may fail. When you first start the program, a window flashes open and then closes. A new icon is now in the system tray. It installs hotkeys as follows:
- Windows Key + Z - Open switcher
- Windows Key + Numpad 1...4 (with numlock on) - Switch to desktop x
When you hit Windows Key + Z, everything starts to fade to black and any windows you have open will appear as thumbnails in the first desktop in the upper lefthand corner. You can drag windows around and they will move in real time. If you drag them to a different desktop, they will disappear. To move between desktops, either double-click a window on a desktop, or use the arrow keys to select a desktop and then press enter to switch to it. You can also press escape to hide the switcher.
Every time you switch desktops, the switcher window gives a visual representation of the switch.
If you right-click on the tray icon, you are presented with standard options and a menu for switching between desktops.
How it Works
I'll go over the internals of the program by class. A lot of tricks are needed in order to get everything working. I have not only classes that will be useful in other projects, but a library I'll do another article on named PPAB Forms.dll. This library contains many useful graphical functions and most importantly, it offers a class called Form that inherits from System.Windows.Forms.Form that displays a layered window. If you don't know what a layered window is, it's a special kind of window that is composited and can have per-pixel alpha information (PPAB stands for per-pixel alpha blending). That's right, before Vista and DWM, there were layered windows. You can use them for all kinds of graphical things. If you've ever used Object Desktop, Konfabulator, ObjectDock, etc, or seen the old Adobe Reader alpha-blended splash screen, you've seen layered windows in action.
This class mainly wraps the Vista thumbnail API. You give it source and destination windows. Then, you set some properties and call UpdateRendering. This starts the rendering. It is disposable, so you can stop the rendering completely by calling dispose. to download