Solved

how to Create plugin in delphi

Posted on 2003-11-28
10
712 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
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9841803
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now