The Windows 7 Taskbar is one of the most noticeable and useful features of the new operating system, and MFC 10 introduces a number of enhancements that make it easy to integrate the Taskbar with your application.
The Taskbar represents the central point for quick access and summary information for an application running on Windows 7. The Jump list, which is launched from the Taskbar, gives quick user access to destinations (such as documents) and tasks relevant to a particular application, and MFC Jump list development has been covered in two previous articles on basic Jump list support and advanced Shell link features. In addition to the Jump list, the Windows 7 Taskbar offers functionality for thumbnail preview of open documents, progress indication and icon overlays. This article will cover how the MFC developer can take advantage of these features.
Taskbar thumbnail support is one of the
MFC 10 features that can be taken advantage of with minimal developer effort. By default, Windows 7 will generate a thumbnail preview of the entire application window. For SDI applications like Word 2007, this will give a good user experience as each running Word process will share the same Taskbar icon, and a thumbnail will be generated for each Word process, allowing the user to visually select the particular Word document they want to access. Figure 1 shows an example of this thumbnail support.
Figure 1. SDI Application Thumbnails
For MDI applications, the default taskbar thumbnail behavior is not as useful, with a single thumbnail generated for the application. This means that the user cannot switch between multiple open documents from the taskbar thumbnail, and must instead use the built-in document selection mechanism of the MDI application. To achieve a more useful taskbar thumbnail experience, applications can use the
COM ITaskbarList3 interface to generate thumbnail previews for each document that the MDI application has open and the user can select the desired document to activate directly from the taskbar. Adding each MDI document to the taskbar is achieved by calling
ITaskbarList3::RegisterTab, and this code is present in the
MFC CMDIChildWndEx::RegisterTaskbarTab method.
RegisterTaskbarTab creates a proxy window for the MDI child frame and creates a mapping of this proxy window to the parent MDI child frame Then calls
ITaskbarList3::RegisterTab to add the proxy window to the taskbar.
The complexity of dealing with Taskbar thumbnails is entirely hidden if the MDI application uses the Tabbed documents style, which is the default setting for the MFC AppWizard, as shown in Figure 2. With these settings in place, the MDI thumbnail behavior shown in Figure 3 will occur. MFC will use the document and application name separated by a hyphen for the thumbnail title, and will also add a thumbnail tooltip with the same information.
Figure 2. MDI Tabbed Documents Settings
Figure 3. MFC MDI Application Thumbnail View