Solved

how to Create plugin in delphi

Posted on 2003-11-28
10
718 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to fill array with TArray.Create? 14 87
Dev Express grid collapse 2 44
LAN or WAN ? 11 90
IdTCPClient and IdTCPServer exchanging data on desktops and not Android 11 113
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

785 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