Solved

how to Create plugin in delphi

Posted on 2003-11-28
10
723 Views
Last Modified: 2013-11-23
Hi Experts,


I know the plugin is also a type of DLL but I have a few queries on this

1. I would like to know the basic difference between DLL and plugin?
2. Is COM based DLL can be created as plugin (Example Google Tool Bar in Internet Explorer)?
    If so how application identifies this plugin, as this is third party component?
3. How to create plugin using regular DLL concepts. How Application identifies the
    plugin functionalities?How to bind plugin to application? How to make the plugin to identify
    application objects (forms and thier sub components)?
4. And finally I want a code examples with detailed explaination.

Thanks and Regards
Sreenu
0
Comment
Question by:sreenu_v78
  • 6
10 Comments
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9837087
listening
0
 
LVL 5

Accepted Solution

by:
DeerBear earned 68 total points
ID: 9837195
Hi,

> And finally I want a code examples with detailed explaination.

Nothing more? <g> Ok, I'll try to explain as wide as I can.

I'll be speaking here of *DELPHI* and plug-ins, thus - even though most of what I'll say is
applicable to other environments as well, it's wholly applicable only to Delphi.

-Difference between Plug-in and Add-in:

The main difference between the two is simply that an ADD-IN is simply ADDED, no
registration with the main app is usually necessary.
A plug-in, instead, usually requires it.

There're several different kinds of plug-ins that can be created with Delphi:

1) DLL plug-ins
2) COM plug-ins
3) Package plug-ins
4) UDP Plug-ins
5) IPC Plug-ins

You have most probably heard about the first 3 kinds, but not the last 2 <g>.
This is because they're VERY rare and not much used due to their incommodity
during development and usage, especially IPC ones.

So, we'll focus on the most common ones: the first 3.

DLL-PLUGINS:

Advantages: Can be written in ANY language supporting DLL creation
Disadvantages: are routine-based, thus can be quite difficult to manage, in case
special needs are in place.

COM-PLUGINS:

Advantages: Can be written in ANY language supporting COM servers.
                   They use an OO approach, so that it's easier to manage them and
                   their configuration is extremely easy
Disadvantages: They only support OLEVariant types, thus no custom Delphi classes,
                       unless you use custom marshalling, which is *awful*.

PACKAGE-PLUGINS:

Advantages: Are fully OO compliant, can import custom Delphi classes and at the
                  same time are true DLLs, so while it can be a plugin for an application,
                  the same package can also be plain DLL for another app - which is
                  quite a good thing :-)
                 They support all Delphi's predefined and CUSTOM types with NO variants.
Disadvantages: Plug-ins can only be written in Delphi, of course.

Now, this is a small piece of code showing you more or less how a plug-in framework should
look like:

Type
     
      TPluginBase = class( TPersistent )
      end;
     
     TPluginMenuInfo = class( TPlugInBase )
      protected
          function GetPosition : Integer;virtual;abstract;
      published
        property ItemCaption : String;
        property MenuCaption : String;
        property Position : Integer read GetPosition;
     end;
   
    TPluginCommand  = class( TPluginBase )
    private
      FMenuInfo : TPlugInMenuInfo;
   protected
      function CreateMenuInfo : TPlugInMenuInfo;
   public
      procedure Execute;virtual;abstract;
   end;

   TPlugInCollection = class( TPlugInBase )
   private
      function GetPlugIn( Index : Integer ) : TPlugInCommand;
  public
      procedure AddPlugIn( Plg : TPluginCommand );
      procedure DelPlugIn( Plg : TPluginCommand );
   published
      property PlugIns[ Index : Integer ] : TPlugInCommand read GetPlugIn;
   end;

This is, more or less, how a plug-in framework should be layed out.

For further inspection of this topic, please have a look at GetClass, FindClass,
LoadPackage and TClass.

HTH,

Andrew
0
 
LVL 14

Assisted Solution

by:sudhakar_koundinya
sudhakar_koundinya earned 66 total points
ID: 9841359
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9841803
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9841806
0
 
LVL 12

Assisted Solution

by:Lee_Nover
Lee_Nover earned 66 total points
ID: 9856402
lots on plugins :)
I still prefer the interfaced approach
http://leenover.homeip.net/isapi/pas2html.dll/pas2html?File=/delphi/PluginExample
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9864405
sreenu

I suggest you to go through this link

http://www.chami.com/tips/delphi/011097D.html This is initail step to write a plugin. Helps alot

0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9864742
sreenu

http://delphi.about.com/library/weekly/aa041100b.htm

Good Articles List on dlls
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 130
enhance the following code 3 42
DBCtrlGrid, Delphi, Scroll 8 55
Firemonkey Listview item popup menu ? 1 25
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question