Objective
I write the Delphi program is from the MIS system, beginning to try to partition the subsystem when using the MDI form structure. With the expansion of the system function, there are new subsystems to join the system, a single project will become very large, every time to do a little modification to recompile, the form of a single project is not conducive to teamwork. To improve productivity, I want to use DLL dynamic link library form to implement the plug-in structure programming.
The programming of the plug-in structure requires a plug-in container to control the operation of each DLL, arranging each subsystem into a DLL library file. For each DLL program, you need to reserve an interface function for the container, and the generic interface functions include: Start the function that calls the DLL library, and close the DLL library. Through the interface function, the plug-in container can transfer parameters to the DLL module to implement dynamic control. Detailed implementation details I will explain and give the response code below.
You may need to understand the structure of the Unit in Delphi, the structure of the project. This article did not delve into the theoretical details of DLL programming, but only demonstrated some practical code, I was learning Liu Yi Teacher's "Delphi in-depth Programming" book.
I am also in the introductory stage of Delphi, just feel that this DLL development there are some worthy of discussion, so write this article, I hope you can do for me a bad place generous suggestions.
Introduction to Sample Programs
For readability I will use part of the MIS system's program code to demonstrate some of the methods of plug-in programming. The sample program is a typical C/s structure DBMS application, and our focus will be on the control statements of the framework Program (Hall) and the response control of the DLL plug-in program.
1. Program Structure
Plug-in Container Hall is created with a separate project, Hall's main window acts as an MDI container form in the MDI program, and Hall will explicitly call the interface functions in the DLL.
Each plug-in uses its own engineering independently, unlike ordinary engineering, DLL engineering creates DLL Wizard, and the resulting file is a DLL suffix.