Before we dive into the Shell Libraries programming model, we need to understand how the Windows Shell works. The Windows Shell is the main area of user interaction in Windows. The Shell includes user-facing Windows feature such as the Taskbar, the Start Menu, Windows Explorer windows, search results, and even less obvious windows such as the Control Panel. The shell is hosted in a process called explorer.exe, and most users recognize it as Windows Explorer.
The Windows Shell enables users to accomplish a variety of tasks, including launching applications and managing the operating system by performing operations on shell objects. The most common shell objects are folders and files, followed by virtual objects such as the Recycle Bin, Printers, or the Control Panel.
Shell objects are organized into a hierarchical namespace that encompasses the file system namespace. The shell namespace includes folders and files; folders that are not part of the physical file system are also called virtual folders. The root of the shell namespace hierarchy is the user’s Desktop, followed by virtual folders such as My Computer and Recycle Bin, and of course “regular” folders and files’ shell objects. To navigate the shell namespace, programmers use item ID lists, which contain a path to a shell object. These lists can be absolute (begin at the root of the namespace) or relative, just like file system paths.
Windows applications interact with and extend the Windows Shell using COM interfaces and structures, which are accessible from most Windows programming languages. Specifically, C++ and .NET applications have paved the road for direct access to the shell, which is implemented in shell32.dll. Some examples include the following:
Other examples for shell integration include Search Providers, Desktop Gadgets, Synchronization Center handlers, Control Panel items, custom Windows Explorer toolbars, Taskbar desk bands, and many others.
In the rest of this section, we’ll review some of the most important shell interfaces to provide a common understanding of these for the discussion of them in the rest of this article. Often, you will not need intimate knowledge and understanding of how a specific shell interface works; however, being aware of its existence and possibilities increases your ability to successfully integrate an application into the Windows 7 experience.
IShellFolder The IShellFolder interface represents shell folder objects from the shell namespace. Its methods enable the user to determine the contents of a folder, to retrieve the display name of an item in a folder, and to parse a display name relative to the folder and obtain an item ID list. Objects implementing this interface are usually created by other Shell folder objects.
You typically begin browsing with shell folders by using the SHGetDesktopFolder function to retrieve the desktop folder; you then proceed from there to request a specific shell folder in the hierarchy. Known Folders, represented by the KNOWNFOLDER enumeration, can be accessed at any time without you having prior knowledge of their specific file system path using the SHGetKnownFolderItem method. Shell folder objects can be added to Windows 7 shell libraries. Note that a library is also represented by a shell folder object, which is not surprising because it appears in the shell namespace.
IShellItem The IShellItem interface represents an item in the shell, typically a file. A shell item is an absolute item ID list. Items are individual, self-contained content sources. The Windows Vista extension of this interface is called IShellItem2, and it provides the ability to query the property store associated with a shell item. Property store represents a generic way to address different object properties.
Since each shell object can have any number of properties and a wide verity of properties types, there is a need for a way to set and get any COM’s object properties. The PROPVARIANT structure is used in the ReadMultiple and WriteMultiple methods of IPropertyStorage to define the type tag and the value of a property in a property set.
IPropertyStore The IPropertyStore interface can be used to manage the property store associated with various shell objects. For example, a shell link is associated with a property store that specifies the application user model ID (also known as the AppID) of its target. Dozens of other properties are provided by the Windows Shell and can be set and queried programmatically by applications using the GetValue and SetValue methods.
Applications do not implement the shell item interfaces. To create a shell item, programmers use the SHCreateItemFromIDList and SHCreateItemFromParsingName, or CoCreateInstance with CLSID_ShellItem. Shell items are the currency of the Shell UI and its programming model, and they are used throughout this article in shell libraries, Jump Lists, and elsewhere. IShellLink The IShellLink interface represents a link in the shell, typically a link to a file or a program.
A shell link is associated with a path to an item (for example, a program), commandline arguments that are passed to it, an icon location and index for the shell link, the working directory for the shell link target, and a keyboard shortcut and other properties. Shell link objects can be used to resolve their target, even if it has been moved or renamed, through the Resolve method.
Shell links can be created using CoCreateInstance with CLSID_ShellLink. Shell links are frequently used as Windows 7 jump list tasks and destinations.
IShellLibrary The IShellLibrary interface represents a Windows 7 shell library, which provides an abstraction to a collection of locations with a common trait. Using the shell library object, applications can add, modify, and remove folders from the library; enumerate folders in the library; retrieve the default save location for the library; and resolve the target location of a library folder.
Programs interact with the IShellLibrary interface by calling the SHLoadLibraryFromItem, SHLoadLibraryFromKnownFolder, or SHLoadLibraryFromParsingName function. New libraries can be created using the SHCreateLibrary method. Other helper functions can be found in ShObjIdl.h and ShellAPI.h, which are part of the SDK, for resolving folder paths in libraries and for adding folders to a library.
ITaskbarList ITaskbarList is part of the Windows Shell programming model. However, it belongs to the Taskbar interface and not to the Libraries interface. Because we provide an overview of the Windows Shell, it makes sense to mention this interface. The ITaskbarList interface (or more specifically, the ITaskbarList3 and ITaskbarList4 interfaces) represents the Windows taskbar functionality, which is part of the Windows Shell. Windows 7 introduces unified launching and switching taskbar button functionality, including rich thumbnail representations and previews, thumbnail toolbars, progress and status overlays, switch targets based on individual tabs.
Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
This article was sent to us by:
Ulmer O. at
01282010
1. Windows 7 installs drivers from trusted publisher
All articles in this directory are property of their respective authors. Additionally, read our Privacy Policy
© 2010 WebWorldarticles.com - All Rights Reserved.