Windows 7 Taskbar: APIs
After all the introductions (see also the Windows 7 blog), there’s nothing left but to dive into the APIs you need to leverage the new Windows 7 Taskbar functionality. The SDK contains reasonably good documentation for this stage of the product. However, the documentation addresses the native code developer - Win 32 API and COM. What about all the managed code developers out there who want to opt into the Windows 7 Taskbar experience? In the near future, the Windows Bridge (still a code name) project will include Windows 7 features like the Taskbar and Libraries. However, until that time, we want to provide you with the following managed code wrapper for the Windows 7 Taskbar. This wrapper is based on the Vista Bridge Sample Library V1.3.
But first things first – where is the code? How do you get the code? By the time you read this, the code will have been uploaded to the MSDN Code Gallery, and can be downloaded from http://code.msdn.microsoft.com/Windows7Taskbar (direct download link).
The general structure of the solution is:
- A modified version of the Vista Bridge Sample Library (also on Code Gallery)
- The main wrapper assembly, Windows7.DesktopIntegration
- Several demo projects, showing various aspects of the wrapper and of the underlying Windows 7 taskbar features
Let’s take a sneak peek at the main classes that provide an entry point to the taskbar functionality (we will look at them in more detail in subsequent posts):
- The Windows7Taskbar class provides low-level facilities for manipulating the process-wide and window-specific application ids, controlling custom window preview bitmaps, setting the taskbar overlay icon and progress bar and clipping the taskbar thumbnail.
- The JumpListManager class provides an abstraction of the application jump list, including facilities to manipulate custom destinations, user tasks, recent/frequent lists and items removed by the user.
- The ThumbButtonManager class provides an abstraction of the taskbar thumbnail toolbar, including the facilities to create thumbnail toolbar buttons and receive a notification when they are clicked.
- The CustomWindowsManager class provides an abstraction of a customized window thumbnail preview and live preview (peek), including the facilities to receive a notification when a preview bitmap is requested by the Desktop Window Manager (DWM) and to automatically grab the preview bitmap of a window.
Let’s also see what the demo projects demonstrate:
- The DocumentReader sample demonstrates how thumbnail clipping and thumbnail customization can provide a better user experience when the information displayed in the thumbnail is too small or unreadable by default.
- The IMClient sample demonstrates how taskbar overlay icons and taskbar progress bars can light up an application’s taskbar button instead of relying on an additional dialog or on an icon in the system notification area (tray).
- The WebBrowser sample demonstrates how custom window previews can be used to expose a list of child windows (browser tabs) as thumbnail- and peek-enabled windows in the taskbar. (Please note that due to the architecture of the underlying native feature, this managed implementation leaves much to be desired.)
- The MainDemo sample demonstrates a glimpse into nearly each part of the new taskbar functionality, including registering a file type association, building a jump list with custom categories and custom tasks, setting an overlay icon and progress bar and many other features.
Curious what goes into the implementation of each feature? How to use only a few lines of managed code to build a jump list, provide a taskbar progress bar or overlay icon, customize your thumbnail preview and more? Stay tuned for subsequent posts.