Plugin Management Frame for Delphi (1)

zhaozj2021-02-11  186

1 Introduction

1.1 plugin technology

Many software uses "plugins" to extend their features, such as Photoshop supports all kinds of filters are plugins; Winamp we are well known, there are also many skin and visual effect plugins. There is another Microsoft's Windows Media Player, and QQ, surfing software Opera ... use plug-in technology's number of software, and the specific implementation of each software is also a five-flowers, each has its own characteristics.

The starting point of the plugin technology is mainly to make the software flexibly extended, without having to recompile and publish the main program (framework program). Its principle is quite simple. The function of the software is determined by the framework and plugin. There is a specific interface between the framework and the plugin, and both must pass the interface to deliver data or control information to implement software functions. Therefore, as long as the program (or other functional entity) is contemplated, the plugin of the frame program is called the frame program.

The plug-in entity is generally divided into two, one is a program containing logic, such as dynamic libraries, exe programs, etc .; the other is a set of configuration information. The previous way is more common in the mapping software, the media playing software, suitable for complex functions; the latter way is mostly used to implement software SKIN (skin) function, and other functional modules that do not need complex operations (there are many games The level of software is also implemented in this way, such as the connection between Ada software).

This article gives the frame program and usage example of the DLL to manage the DLL in the process of implementing the DLL plug-in method, as the foundation of the plug-in design. Specifically, the framework needs to complete the loading, functional call, and uninstall three types of functions.

1.2 actually ...

In fact, each control panel program is a plugin for operating systems. Because each .cpl file is a DLL that implements a specific interface. The same is true for Windows service programs, but it is only to process specific Windows messages on the basis of the original program.

In fact, from a broad sense, each running on the operating system is "plugin" of this software software.

In fact, in Delphi, there is already a framework for plug-in, that is, BPL. The use of BPL component packages can also be easily implemented. It is only a shortcoming of this way: other development tools (such as VB, VC ) do not support plug-in development.

2 plug-in frame (unddllmanager)

2.1 Overview

Two basic classes are defined in the unTdllManager unit:

TDLL: The parent class of all DLL classes provides the related operations of loading, unloading;

TDLLManager: Containers of the DLL class. Support to delete an element to uninstall the DLL entity.

The following is a class diagram:

转载请注明原文地址:https://www.9cbs.com/read-5308.html

New Post(0)