November 9th, 2009

How do I create a toolbar that sits in the taskbar?

Commenter Nick asks, “How would you go about creating a special toolbar to sit on the taskbar like the Windows Media Player 10 minimised toolbar?” You would look at the DeskBand API SDK Sample in the Windows Platform SDK. The magic word is DeskBand. This MSDN page has an overview. Bonus chatter: I’ve seen some online speculation as to whether a DeskBand counts as a shell extension, because of the guidance against writing shell extensions in managed code. As with all guidance, you need to understand the rationale behind the guidance so you can apply the guidance intelligently instead of merely following it blindly off a cliff. Summarizing the rationale: Since only one version of the CLR can exist in a process, any shell extension which runs inside the host process which uses the CLR may inject a version of the CLR that conflicts with the version of the CLR the host process (or some other component in the host process) wants to use. Now that you understand the reason, you also can answer the question, “Is a DeskBand a shell extension (for the purpose of this guidance)?” Yes, because DeskBands (like all other COM objects registered as in-process servers) run inside the host process.

As another example of how understanding the rationale behind guidance lets you know when the guidance no longer applies: In the time since the original guidance was developed, the CLR team came up with a way to run multiple versions of the CLR inside a single process (for specific values of “multiple”). Therefore, if you use one of those “I won’t conflict with other versions of the CLR inside the same process” versions, then you can see that the rationale behind the guidance no longer applies.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.