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

 
InfoTip Example
Download Examples

    InfoTip extension allow you to supply a short text that will be shown when user hovers the document. Use it to display an advanced document information.

    The InfoTip handler 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.

    Now add the TSxInfoTip component from the Shell+ palette page. This component wraps interfaces required be shell and allows you to handle shell requests in a simple manner.

    The properties of TSxInfoTip component are as follows:

CLSID Unique identifier, GUID, that is used by system to identify the extension. It is generated automatically when you place component onto SxDataModule.
Description Extension description, enter desired text here.
ExtensionName Short extension name, MyInfoTip for example.
FileType Type of files to be serviced by the extension. Files of specified type will be processed only. This example uses the "txtfile" and handles most of text files such as ini, log, txt and some other.
Name This property is a native Delphi's component name, nothing special.
InfoTip Use this property to specify static text to be displayed in the tip. If you need to supply different tips for different files then use OnGetInfoTip event instead.
OverwriteExistent Currently only one InfoTip extension can be registered for the given file type simultaneously. Use this property to control whether to override previously installed handler. Set the property to True to allow overriding of the existing infotip handler. In addition you can use the OnKeyAlreadyExist event handler to define CLSID of previously installed Infotip handler. You can use this value for backup purposes for example.

Table 1. TSxInfoTip properties.

    Use Object Inspector to set TSxInfoTip properties as shown below:

TSxInfoTip component properties
Fig 3. TSxInfoTip properties

    Every time Shell needs the InfoTup text it calls corresponding shell extension interface. As a result the OnGetInfoTip event is fired in the example. The info text should be prepared and returned as a result of this event.
    Select the Events tab of Object Inspector and doubleclick the OnGetInfoTip event. Add the following code to the event handler:

procedure TSxModule1.SxInfoTip1GetInfoTip(Sender: TSxInfoTip;
  var InfoTip: String);
var
  TempStr:TStrings;
begin
  TempStr:=TStringList.Create;
  try
    TempStr.LoadFromFile((Sender as TSxInfoTip).Filename);
    InfoTip:='Words: '+IntToStr(WordCount(TempStr.Text,[' ']))+#13+#10+
             'Lines: '+IntToStr(TempStr.Count)+#13+#10+
             'Pages: '+InttoStr(TempStr.Count div 60);
  finally
    TempStr.Free;
  end;
end;

    Add and auxilliary procedure to count words in the text document:

function WordCount(const S: string; const WordDelims: TCharSet): Integer;
var
  SLen, I: Cardinal;
begin
  Result := 0;
  I := 1;
  SLen := Length(S);
  while I <= SLen do begin
    while (I <= SLen) and (S[I] in WordDelims) do Inc(I);
    if I <= SLen then Inc(Result);
    while (I <= SLen) and not(S[I] in WordDelims) do Inc(I);
  end;
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.

        Test the example now. To do it create and empty text document on the desktop or in any other folder. Move mouse pointer over this file and wait a couple of seconds. The InfoTip will pop-up, it will look like shown below:

File infotip example

    Enter a couple of text lines into the document now then look on info tip again:

File infotip 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.


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

Delphi 10.1 Berlin (x64)
InfoTip-D24X64.zip
1.08Mb
3.15.296.396
11.09.2016
Delphi 10.1 Berlin
InfoTip-D24.zip
876.27Kb
3.15.296.396
11.09.2016
Delphi 10 Seattle (x64)
InfoTip-D23X64.zip
1.08Mb
3.15.296.396
11.09.2016
Delphi 10 Seattle
InfoTip-D23.zip
869.05Kb
3.15.296.396
11.09.2016
Delphi XE8 (x64)
InfoTip-D22X64.zip
1.08Mb
3.12.289.357
15.05.2015
Delphi XE8
InfoTip-D22.zip
867.57Kb
3.12.289.357
15.05.2015
Delphi XE7 (x64)
InfoTip-D21X64.zip
1.08Mb
3.11.289.357
19.09.2014
Delphi XE7
InfoTip-D21.zip
82.19Kb
3.11.289.357
19.09.2014
Delphi XE6 (x64)
InfoTip-D20X64.zip
1.09Mb
3.10.287.331
16.09.2014
Delphi XE6
InfoTip-D20.zip
82.18Kb
3.10.287.331
16.09.2014
Delphi XE5 (x64)
InfoTip-D19X64.zip
1.04Mb
3.10.287.331
16.03.2014
Delphi XE5
InfoTip-D19.zip
81.72Kb
3.10.287.331
16.03.2014
Delphi XE4 (x64)
InfoTip-D18X64.zip
1.03Mb
3.10.287.331
16.03.2014
Delphi XE4
InfoTip-D18.zip
81.65Kb
3.10.287.331
16.03.2014
Delphi XE3 (x64)
InfoTip-D17X64.zip
1.02Mb
3.10.287.331
16.03.2014
Delphi XE3
InfoTip-D17.zip
81.61Kb
3.10.287.331
16.03.2014
Delphi XE2 (x64)
InfoTip-D16X64.zip
772.09Kb
3.10.287.331
16.03.2014
Delphi XE2
InfoTip-D16.zip
81.47Kb
3.10.287.331
16.03.2014
Delphi XE
InfoTip-D15.zip
77.92Kb
3.10.287.331
16.03.2014
Delphi 2010
InfoTip-D14.zip
77.31Kb
3.10.287.331
16.03.2014
Delphi 2009
InfoTip-D12.zip
45.73Kb
3.10.287.331
16.03.2014
Delphi 2007
InfoTip-D11.zip
44.65Kb
3.10.287.331
16.03.2014
Delphi 2006
InfoTip-D10.zip
44.52Kb
3.10.287.331
16.03.2014
Delphi 2005
InfoTip-D9.zip
45.76Kb
3.10.287.331
16.03.2014
Delphi 7
InfoTip-D7.zip
249.44Kb
3.12.289.357
16.05.2015
Delphi 6
InfoTip-D6.zip
44.92Kb
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.