?
Solved

how to Create plugin in delphi

Posted on 2003-11-28
10
Medium Priority
?
729 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 272 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 264 total points
ID: 9841359
0
Industry Leaders: 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 12

Assisted Solution

by:Lee_Nover
Lee_Nover earned 264 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

801 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