1. Technology
RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To
 
Windows Shell Extensions – Info Tip
Page 1: Shell extensions allow developers to add functionality to the existing Windows shell.
 More of this Feature
• Page 2: InfoTip overview
• Page 3: Delphi project
 Join the Discussion
"Post your questions, concerns, views and comments to this article..."
Discuss!
 Related Resources
• Win/API articles
• COM/OLE articles

Creating the InfoTip Shell Extension, which lets us, control the information that appears in Explorer when the mouse hovers over a file. Creating a Delphi Infotip that will display the FileName, the project type (Program or Library), the Project Name (from the source file), and the size of the file in bytes.

Article submitted by: Larry J. Rutledge

With each new release of Windows, its shell becomes more and more advanced and adds many new useful features. One of the ways this is done is through shell extensions. These extensions allow developers to add functionality to the existing Windows shell. Some examples of shell extensions are Context Menus (menus that change based on what object has focus when you right-click), Property Sheet Handlers (tabbed pages that appear when the Properties menu item is selected from an object’s context menu), Icon Overlays (appear as the arrow on top of an icon that points to a shortcut or the hand that appears on shared folders), Folder Customization, and many, many more.

Over the course of a few articles we will examine several of these extensions and, in particular, how to build them in Delphi. There is plenty of information about shell extensions available from the Microsoft web site, but these articles will bring it to the Delphi audience. In this first article we will look at the InfoTip Shell Extension, which lets us control the information that appears in Explorer when the mouse hovers over a file.

Important Note
The following paragraph from Dino Esposito’s article, "Windows 2000 UI Innovations: Enhance Your User’s Experience with New Infotip and Icon Overlay Shell Extensions" (MSDN Magazine, March 2000) is a good description of what versions of Windows these extensions apply to:
"…I should point out that not all the features I'll cover here are completely new. Many of them were already introduced with the Desktop Update – a separate shell update available both for Windows 9x and Windows NT 4.0. The Desktop Update shipped with Microsoft Internet Explorer 4.0 and Windows 98. Note that the Desktop Update is not part of Internet Explorer 5.0. So if you want to install it on Windows NT 4.0, you need to install Internet Explorer 4.0 first, making sure you select the Desktop Update option. Internet Explorer 5.0 will upgrade an existing Desktop Update on Windows NT 4.0 and Windows 95, but will not install it from scratch."

   Shell Extension – Quick Overview
Shell Extensions are implemented as In Process COM servers. Windows Explorer invokes the appropriate extension in response to shell-wide events. Explorer was designed to respond in very specific ways when the user performs various functions within its shell. The first thing Explorer does is check for any modules that have been registered for a specific event and if one exists it attempts to load the module.

To be a valid shell extension, the COM server must implement an interface that defines the specific behavior for the desired extension and it must implement an interface that defines its initialization behavior. Finally, to be a valid shell extension, the COM server must follow the approved method of registering itself with the system.

The following table from Dino Esposito's article "Windows 2000 UI innovations: Enhance Your User's Experience with New Infotip and Icon Overlay Shell Extensions" (MSDN Magazine, March 2000), lists all the types of shell extensions available today, the minimum shell version each requires, the involved interfaces, and a brief description:

Type Apply To Version Interface Involved Description
Context Menu File class and shell’s object Windows 95+ IContextMenu, IContextMenu2, or IContextMenu3 Allows you to add new items to a shell object’s context menu.
Right Drag and Drop File class and shell’s object Windows 95+ IContextMenu, IContextMenu2, or IContextMenu3 Allows you to add new items to the context menu that appears after your right drag and drop files.
Drawing Shell Icons File class and shell’s object Windows 95+ IExtractIcon Lets you decide at runtime which icon should be displayed for a given file within a file class.
Property Sheet File class and shell’s object Windows 95+ IShellPropSheetExt Lets you insert additional property sheet pages to the file class Properties dialog. It also works for Control Panel applets.
Left Drag and Drop File class and shell’s object Windows 95+ IDropTarget Lets you decide what to do when an object is being dropped (using the left mouse button) onto another one within the shell.
Clipboard File class and shell’s object Windows 95+ IDataObject Lets you define how an object is to be copied to and extracted from the clipboard.
File Hook   Windows 95+ ICopyHook Lets you control any file operation that goes through the shell. While you can permit or deny them, you aren’t informed about success or failure.
Program Execution Explorer Desktop Update IShellExecuteHook Lets you hook any program’s execution that passes through the shell.
Infotip File class and shell’s object Desktop Update IQueryInfo Lets you display a short text message when the mouse hovers over documents of a certain file type.
Column Folders Windows 2000 IColumnProvider Lets you add a new column to the Details view of Explorer.
Icon Overlay Explorer Windows 2000 IShellIconOverlay Lets you define custom images to be used as icon overlays.
Search Explorer Windows 2000 IContextMenu Lets you add a new entry on the Start menu’s Search menu.
Cleanup Cleanup Manager Windows 2000 IEmptyVolumeCache2 Lets you add a new entry to the Cleanup Manager to recover disk space.

Next page > InfoTip – Introduction and Overview > Page 1, 2, 3

All graphics (if any) in this feature created by Zarko Gajic.

 More Delphi
· Learn another routine every day - RTL Quick Reference.
· Download free source code applications and components.
· Talk about Delphi Programming, real time.
· Link to the Delphi Programming site from your Web pages.
· Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC.
· NEXT ARTICLE: New...Access Database from Delphi - DB/13.
Chapter thirteen of the free Delphi Database Course for beginners. How to create an MS Access database without the MS Access. How to add an index to an existing table, how to join two tables and set up referential integrity. No MS Access, only Pure Delphi code.
 Stay informed with all new and interesting things about Delphi (for free).
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.