Solved

how to Create plugin in delphi

Posted on 2003-11-28
10
724 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 97
How to open a new windows chrome resized and disabled the toolbar? 3 222
PHP preg_replace code convert to Delphi 14 95
QuickReport, Delphi, Shape 12 44
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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