June 2009 - Posts
Yochay and I wrote an article on the Windows 7 Taskbar APIs for the July 2009 issue of MSDN Magazine. It pretty much covers what I already posted on this blog (see the Windows 7 tag), and what Yochay has been posting on the Windows 7 Blog for Developers for a couple of weeks now.
It was a great opportunity to repeat the awesome screenshot of Windows 1.0 and how similar its taskbar is to Windows 7’s :-)
Nonetheless, you might find it useful because it organizes the information into a digestible form, with native and managed APIs (using the Windows API Code Pack, of course) shown side by side. Some topics aren’t covered – e.g. you won’t find any information on window switchers in this article – but there’s only so much we could squeeze in a single piece.
Microsoft has published the Windows 7 RC Training Kit, reflecting some of Sela’s work (Alon’s, Dima’s and mine) during the past few months. We worked hard to update the materials to match the Windows 7 RC, and now they are publicly available along with a multitude of hands-on labs, code demos and a bunch of other material.
If you haven’t had a chance to experience Windows 7 yet, you should definitely give the training kit a shot. And if you were afraid to try writing code for Windows 7 because there are no official .NET APIs, then you should definitely look at the Windows API Code Pack and the sample interop wrappers I’ve blogged about many times in the past.
There have been some minor updates in the Beta to RC timeframe with regard to the Windows 7 Taskbar APIs. Just a brief reference:
- The upside-down bug with custom thumbnails and live previews has been fixed.
- There’s a new interface, ITaskbarList4, which extends ITaskbarList3 with the SetTabProperties method, which allows customization of when to use the thumbnail or live preview provided by the main application window and when to use the thumbnail or live preview provided by the individual tab. (This is useful for applications like Internet Explorer, which might find it easier to render the main frame if a preview for the currently active tab is requested.)
- Applications can opt out of pinning to the taskbar (which, incidentally, also prevents them from being pinned to the Start Menu). This can be done by adding the PreventPinning shell property to the application’s shortcut, or setting it on the window’s shell property (through SHGetPropertyStoreForWindow). Alternatively, the new STARTF_PREVENTPINNING flag of the STARTUPINFO structure allows the same to be done for a newly created process.
There was a minor bug in Windows 7 Beta which caused bitmaps passed to DwmSetIconicLivePreviewBitmap and DwmSetIconicThumbnail to be rendered upside-down in the thumbnail and live preview. (To work around this bug, the Windows 7 Taskbar Sample Library incorporates a special flag that allows mirroring the bitmap before passing it through to DWM.)
This has been fixed in Windows 7 RC, so there’s no need to render top-down bitmaps anymore. Whatever bitmap you provide will be rendered exactly as you see it. (There are still the obvious dimension constraints, etc.)
Incredibly, I haven’t got a chance to blog about the Windows API Code Pack yet – even though it’s been out on MSDN Code Gallery for a couple of months already. It’s an open source .NET library which provides interop wrappers to Windows 7 (and Windows Vista) features. In fact, it would be unfair to say that these are wrappers – some of the features are organized and designed to make access from managed code significantly easier than from the native Win32/COM counterparts.
By the time of this writing, there are already several extensive posts on the features covered by the Windows API Code Pack, so I would rather refer you to them instead of rehashing:
The latest release of the Windows API Code Pack (version 0.90) is fairly close to stable, and is feature-complete with regard to several areas of the Windows 7 APIs. Specifically, the latest release incorporates the following features of the Windows 7 taskbar, my pet feature:
These features are up-to-date with the latest Windows 7 RC changes from Beta, which I will briefly cover in a future post. There are a couple of things that didn’t work smoothly for me – for example, there is a bug with thumbnail toolbars when using them in a 64-bit process. However, I’m sure these things will be sorted out by the time v1.0 is released.
There are also significant updates in other areas – Direct2D, DirectWrite, WIC, Sensor platform, and other Windows 7 APIs. The library is definitely worth checking out, and it’s time that we start phasing out the sample wrappers developed during the past few months. It’s been a great time, but it’s also about time that these samples are replaced by a properly tested library, which seems to have potential for support at some point in the future.