ShellPlus Customer login
ShellPlus
Shell+ components
    Home
    News
    Overview
    Download
    Examples
    Customer's area
    Flash Demo
 
Developer Tools
    Shell Reset Tool
 
Shell+ Tutorial
    Namespace Extensions
    ShortCut menu
    Property Sheet
    Icon Handler
    Thumbnails
    InfoTip Handler
    Copy Hook
    Balloon TrayIcon
    Control Panel
    Shortcut Files
    Drag&Drop Menu
    Shell Change Notify
 
Powered by Shell+
    Romeo Burner
 
Documents
    Articles Index
    Press Releases
 
Purchase
    Buy now
    Resellers network
    Resellers wanted
 
Support
    Contact directly
    Customer's area
 
About/Contacts
    Shell+ Developers

Embarcader Technology Partner

 
Namespace extension Example

    Use this kind of Shell Extensions to create your own virtual folders and items to Windows Shell namespace. Using these extensions your users will be able to reach the data through native Windows Explorer interface. This example will show how to use a couple of forms and a few components to implement your own namespace extension.

    The Namespace Extension is an ActiveX library like all other Shell Extensions. The first step to do is to create a new ActiveX Library. Create it with the following sequence of operations: open the Repository dialog using File | New | Other... menu, then select the ActiveX tab and click the ActiveX Library icon.

Create New ActiveX Library
Fig. 1. New ActiveX Library creation.

    Save the created project.

    The next step is to add the instance of TSxDataModule to the project. Every Shell+ component should be placed on SxDataModule 1. This special descendant of TDataModule supplies several internal methods that allow Shell+ components to safely operates in multiple Shell threads and automates their registration and initialization. Note that you can place several Shell+ components onto the same SxDataModule as well as you can add multiple TSxDataModule instances to your project. It is easy to add new SxDataModule to the project - just click corresponding icon in the Repository:

Create New Shell extension module
Fig. 2. How to create new SxDataModule instance.

    You can save the project now.

    Every Namespace Extension library has to operate inside the Windows Shell browser - Explorer.exe. Let's consider the figure below to learn more about different parts of the Explorer. As you can see there are two Shell+ components that help you to implement your own namespace. The first one - TSxVirtualFolder - controls folders and files. The second one interacts with Explorer's menu, status bar and toolbar.

Windows Explorer inside

    Add the TSxVirtualFolder now. Use this component to create namespace items that are not related with file system structure. The registration data of extension based on this component will be stored in registry. Note that it is one of several possible registration methods. This method has a limited number of junction points if compared with file-related method of registration. On the other side only this method allows to add extensions to system virtual folders such as "My Computer", "Control panel", "My network places" etc.

    Look on the properties of TSxVirtualFolder component:

CLSID2

Automatically generated GUID. All shell extensions use it to be identified by system.

Description

Extension description, enter desired text here.

ExtensionName

Short name of the extension, MyNamespaceExtension for example.

Name

An ordinary name of the Delphi component.

Attributes2

Attributes of the root folder of the extension.

ContextMenuHandler2

TSxContextMenu link. This component will show the context menu for your shell extension. Important: always place these two components on the same form..

DataProvider

Data provider reference. Several types of data providers are available. The data can be static (TSxSimpleTreeProvider) or dynamic (TSxDataSetTreeProvider), they can be stored in file or modified in run-time. In other words there are many ways to implement shell extension behavior you need and below you will find a details explanation how to use some of them.

DefaultIcon2

Default icon of the root folder. It is stored in a form: [filename],[icon index]. For example: ExNSESysShellView.dll,0

DeleteOptions2

This property controls what occurs when user tries to delete the root folder of the namespace extension. Windows Shell can prohibit the operation or hide it from users.

ExtractIconHandler2

TSxExtractIcon reference. Use it to supply dynamic icons for your extension. Note: this component must be placed onto the same form as TSxVirtualFolder.

HideFolderVerbs2

If this property is True the context menu of your extension will hide standard verbs Open and Explore...

JunctionPoint2

Select one of virtual system folders to attach your namespace extension there. The opportunities are: Control Panel, Desktop, Entire Network, My Computer, Network Neighborhood or Remote Computer.

PropertySheetHandler2

TSxPropSheetExt reference. Use this component to add property pages to the root folder of your namespace extension.

QueryForOverlay2

If this property is True then Windows Shell will query your extension about overlay icon for the root folder of the namespace extension.

ShellCommands2

This property controls the context menu commands to displayed for the root folder. Enter commands you would like to override there. Sub-property AnotherCommands you can specify your own additional commands for the Namespace extension.

ShellView

Folder view manager reference. This component controls how the contents of the extension will be displayed at the right pane of Explorer.

StaticInfoTip2

Info tip for the root folder of your namespace extension.

WantsForParsing2

If this property is True then Windows will ask for file and folder names for every element of your namespace extension.

Table 1. TSxVirtualFolder component properties

    Configure the Shell View component now. This component shows the list of files and folders at the right pane of Explorer. The TSxSysShellView is used below in this example. This component uses the native Windows 2000 and Windows XP abilities of the Shell View.
  Note that this component must be placed on the same form as the Shell Folder component. Use the ShellView property of the TSxVirtualFolder component to link them.

    TSxSysShellView has no special properties to be configured.

    Add one TPermanentModule to the project. The difference between this TPermanentModule and TSxDataModule is that the TSxDataModule is created dynamically and can be unloaded at any time while TPermanentModule exists always in one instance. It is this module should carry all data-related components such as TDataSet successors, TSxDataProvider successors and their related components.

    Place a TSxSimpleTreeProvider component onto this Data Module. Connect it to the DataProvider property of the TSxVirtualFolder. Do not forget to modify the uses clause to avoid compiler errors.

    Right click the component now. You will see the menu with a "Tree editor..." item at the top. Select this item. The editor of the TSxSimpleTreeProvider will appear.

Simple Tree Component Editor


    The properties of TSxSimpleTreeProvider component are as follows:

BackgroundContextMenu

TPopupMenu reference. This menu will be shown when user right clicks the right pane.

BasicVerbs

Explore, Open and Properties menu items. Use this properties to override standard verbs.

CommonContextMenu

TPopupMenu reference. This menu will be shown for folders and files of your namespace extension.

FileContextMenu

TPopupMenu reference. This menu will be shown for files only.

FolderContextMenu

TPopupMenu reference. This menu will be shown for folders only.

FolderIcon

Icon index. It will be used to display the icons of the extension folders.

FolderOpenIcon

Icon index. It will be used to display the icons of the opened extension folders.

ItemIcon

Icon index. It will be used to display the icons of the extension files.

ItemOpenIcon

Reserveed for future use.

LargeIcons

TSxIconList reference. Use this property to supply 32x32 icons for your namespace extension.

SmallIcons

TSxIconList reference. Use this property to supply 16x16 icons for your namespace extension.

    Set OnClick event handles now for all menu items you need. Add necessary icons into TSxIconList components.

    Save the project and compile it - it is ready now! As well as any other ActiveX library the Shell+ project requires registration. You can register it in several ways:

  • from command prompt using MS regsvr32 utility: regsvr32.exe Project1.dll
  • from command prompt using Borland's tregsvr utility: tregsvr Project1.dll

To know more about shell extension installation please follow the link.

The final step is to test the Namespace extension library. Open the Windows Explorer and enter the folder of your namespace extension. It will look like shown below. Note that the position of the root folder is defined by junction point settings:

Delphi Namespace extension example

    Don't forget to uninstall the example when all tests are finished. Note that it is an example only and it will show its confirmation window until you will not unregister it. As well as installation the uninstallation can be done in many ways:

  • from command prompt using MS regsvr32 utility: regsvr32.exe /u Project1.dll
  • from command prompt using Borland's tregsvr utility: tregsvr -u Project1.dll

The detailed information about extension uninstallation is available here.


1. The only exception is the TSxTrayIcon component that does not need to be placed on SxDataModule instance.
2. This property takes effect on extension re-iregistration.

 


    Use links below to download source codes of this example as well as binary files:

This example demonstrates basic functionality of Shell Namespace Extensions. It uses TsxSimpleTreeProvider component.

 


    Other examples:

    TSxByHandProvider Example:

This example will map the computer drive C: as Shell Namespace Extension.

 

    TSxShellFormView Example:

This example demonstrates how to implement custom shell views for Shell Namespace Extensions.

Delphi XE2 (x64)
NSE-ShellViewForm-D16X64.zip
1.08Mb
3.8.287.331
09.05.2012
Delphi XE2
NSE-ShellViewForm-D16.zip
245.83Kb
3.8.287.331
09.05.2012
Delphi XE
NSE-ShellViewForm-D15.zip
241.24Kb
3.8.287.331
09.05.2012
Delphi 2010
NSE-ShellViewForm-D14.zip
240.38Kb
3.8.287.331
09.05.2012
Delphi 2009
NSE-ShellViewForm-D12.zip
173.79Kb
3.8.287.331
09.05.2012
Delphi 2007
NSE-ShellViewForm-D11.zip
172.34Kb
3.8.287.331
09.05.2012
Delphi 2006
NSE-ShellViewForm-D10.zip
172.35Kb
3.8.287.331
09.05.2012
Delphi 2005
NSE-ShellViewForm-D9.zip
173.27Kb
3.8.287.331
09.05.2012
Delphi 7
NSE-ShellViewForm-D7.zip
172.59Kb
3.8.287.331
09.05.2012
Delphi 6
NSE-ShellViewForm-D6.zip
174.85Kb
3.8.287.331
09.05.2012

 

This advanced example demonstrates how to combine custom view mode and system-defined view modes. Read more...

Delphi XE2
ExBioLife-D16.zip
451.91Kb
3.8.287.331
09.05.2012
Delphi XE
ExBioLife-D15.zip
445.86Kb
3.8.287.331
09.05.2012
Delphi 2010
ExBioLife-D14.zip
445.90Kb
3.8.287.331
09.05.2012
Delphi 2009
ExBioLife-D12.zip
333.33Kb
3.8.287.331
09.05.2012
Delphi 2007
ExBioLife-D11.zip
326.11Kb
3.8.287.331
09.05.2012
Delphi 2006
ExBioLife-D10.zip
326.04Kb
3.8.287.331
09.05.2012
Delphi 2005
ExBioLife-D9.zip
322.11Kb
3.8.287.331
09.05.2012
Delphi 7
ExBioLife-D7.zip
319.20Kb
3.8.287.331
09.05.2012
Delphi 6
ExBioLife-D6.zip
317.27Kb
3.8.287.331
09.05.2012

This example demonstrates basic and advanced functonality for Shell Namespace Extension. The NSE works with external executable server via COM interface. Read more...

Delphi XE2 (x64)
NSE-MegaDemo-D16X64.zip
1.19Mb
3.8.287.331
09.05.2012
Delphi XE2
NSE-MegaDemo-D16.zip
333.54Kb
3.8.287.331
09.05.2012
Delphi XE
NSE-MegaDemo-D15.zip
325.74Kb
3.8.287.331
09.05.2012
Delphi 2010
NSE-MegaDemo-D14.zip
324.54Kb
3.8.287.331
09.05.2012
Delphi 2009
NSE-MegaDemo-D12.zip
250.22Kb
3.8.287.331
09.05.2012
Delphi 2007
NSE-MegaDemo-D11.zip
248.26Kb
3.8.287.331
09.05.2012
Delphi 2006
NSE-MegaDemo-D10.zip
247.93Kb
3.8.287.331
09.05.2012
Delphi 2005
NSE-MegaDemo-D9.zip
250.33Kb
3.8.287.331
09.05.2012
Delphi 7
NSE-MegaDemo-D7.zip
249.52Kb
3.8.287.331
09.05.2012
Delphi 6
NSE-MegaDemo-D6.zip
251.35Kb
3.8.287.331
09.05.2012

  Top


Components | Download | Purchase | Support | About Us
Copyright © 2012 ALDYN Software. All rights reserved.
Copyright © 2001 - 2011 Shell+ Development Group. All rights reserved.