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
 
 
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

 
Control Panel Property Sheet Example

    Some Control Panel dialogs can be enhanced with a new property sheets. These dialogs are: Internet Settings, System Settings, Power Options, Keyboard Settings, Mouse Settings, Display Adapter Settings and Desktop Settings. Shell+ allows you to use this Shell feature. Below you will find an example how to do it.

    The Control Panel PropertySheet handler is an ActiveX library like all other Shell Extensions. The first step to be done 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.

Creation of 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:

Creation of new SxDataModule
Fig. 2. How to create new SxDataModule instance.

    You can save your project now.

    The next step is to add the PropertySheet component to the SxDataModule. This component controls the creation of property sheet tabs. To use it simply place it on the SxDataModule and configure its properties.

    Table below shows essential properties of the TSxPropSheetExt component.

CLSID

GUID. As well as other CLSID properties it is generated automatically when you place component on SxDataModule.

Description

Any text that describes your extension.

ExtensionName

Short name of the extension, MyPropertySheet for example.

FileType

In this property you should specify the Control Panel item, where you property sheets would be added. Refer on Fig. 3 for example.

Name

Delphi's name of the component, nothing special

PropertySheets

It is a key property of the TSxPropSheetExt component. It contains the description of forms to be added to the Properties dialog. It is these pages will be shown when user right clicks the file and then selects the Properties menu item. Sure these additional pages will be shown if the file type matches that specified in the FileType property. The editor of PropertySheets will be considered below.

Table 1. TSxPropSheetExt properties.

 

Choose File Class or File Type

Fig 2. Control Panel extension path.

    Set component properties as shown below to continue:

TSxPropSheetExt properties
Fig 3. TSxPropSheetExt properties

    Now add the property page form. This form will be shown as a part of Control Panel applet dialog. Open the Repository dialog with File | New | Other... and select the Shell Extensions page:

Creation Property Sheet Form
Fig. 4. Property Sheet creation.

    Click the Property Sheet Form icon and the new PropertySheet form will be created. You can add VCL controls to it now or you can do it later. There is one more step to be done: the form should be attached to the PropertySheet component that was created earlier. This component has a PropertySheets property. Edit it. It looks like shown below:

Add New Property Sheet
Fig. 5. PropertySheets editor.

    Use the Add button to show the list of all available property sheet forms. Currently there should be only one because you've added one form only. Select it and it will be added to the list of property sheets. Press خت to save changes.

    There are two opportunities: it is possible either add a new property sheets or replace the existing with a new one. Use the OnAddPropSheet and OnReplacePropSheet to control the behavior of the extension. The example below adds a new property sheet only, no other property sheets are replaced. Create the OnReplacePropertySheet event handler and add the following code to it:

procedure TSxModule1.ControlPanelExtReplacePropSheet(
  Sender: TSxShellPropSheetExt; Index: Integer; PropSheetClass: TFormClass;
  var AllowInsert: Boolean);
begin
  AllowInsert:=False;
end;

    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.

Now the example is ready for tests. Right click the desktop and select Properties menu item, you should see something like this:

Extending Display Properties

 

    By handling OnShellExtInitEx event you can get access for initialization information. For details about implementing Property Pages for Display Drivers, please refer to MSDN article.

    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.


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

Delphi 10.1 Berlin (x64)
ControlPanelExtension-D24X64.zip
1.10Mb
3.15.296.396
11.09.2016
Delphi 10.1 Berlin
ControlPanelExtension-D24.zip
890.80Kb
3.15.296.396
11.09.2016
Delphi 10 Seattle (x64)
ControlPanelExtension-D23X64.zip
1.10Mb
3.15.296.396
11.09.2016
Delphi 10 Seattle
ControlPanelExtension-D23.zip
882.60Kb
3.15.296.396
11.09.2016
Delphi XE8 (x64)
ControlPanelExtension-D22X64.zip
1.09Mb
3.12.289.357
15.05.2015
Delphi XE8
ControlPanelExtension-D22.zip
881.19Kb
3.12.289.357
15.05.2015
Delphi XE7 (x64)
ControlPanelExtension-D21X64.zip
1.10Mb
3.11.289.357
19.09.2014
Delphi XE7
ControlPanelExtension-D21.zip
92.79Kb
3.11.289.357
19.09.2014
Delphi XE6 (x64)
ControlPanelExtension-D20X64.zip
1.10Mb
3.10.287.331
16.09.2014
Delphi XE6
ControlPanelExtension-D20.zip
92.74Kb
3.10.287.331
16.09.2014
Delphi XE5 (x64)
ControlPanelExtension-D19X64.zip
1.06Mb
3.10.287.331
16.03.2014
Delphi XE5
ControlPanelExtension-D19.zip
92.50Kb
3.10.287.331
16.03.2014
Delphi XE4 (x64)
ControlPanelExtension-D18X64.zip
1.05Mb
3.10.287.331
16.03.2014
Delphi XE4
ControlPanelExtension-D18.zip
92.43Kb
3.10.287.331
16.03.2014
Delphi XE3 (x64)
ControlPanelExtension-D17X64.zip
1.03Mb
3.10.287.331
16.03.2014
Delphi XE3
ControlPanelExtension-D17.zip
92.39Kb
3.10.287.331
16.03.2014
Delphi XE2 (x64)
ControlPanelExtension-D16X64.zip
788.31Kb
3.10.287.331
16.03.2014
Delphi XE2
ControlPanelExtension-D16.zip
92.18Kb
3.10.287.331
16.03.2014
Delphi XE
ControlPanelExtension-D15.zip
87.86Kb
3.10.287.331
16.03.2014
Delphi 2010
ControlPanelExtension-D14.zip
87.68Kb
3.10.287.331
16.03.2014
Delphi 2009
ControlPanelExtension-D12.zip
55.72Kb
3.10.287.331
16.03.2014
Delphi 2007
ControlPanelExtension-D11.zip
54.71Kb
3.10.287.331
16.03.2014
Delphi 2006
ControlPanelExtension-D10.zip
54.78Kb
3.10.287.331
16.03.2014
Delphi 2005
ControlPanelExtension-D9.zip
55.44Kb
3.10.287.331
16.03.2014
Delphi 7
ControlPanelExtension-D7.zip
255.99Kb
3.12.289.357
16.05.2015
Delphi 6
ControlPanelExtension-D6.zip
54.29Kb
3.8.287.331
09.05.2012

  Top


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