library DllTestFI;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
ShareMem,
SysUtils,
Forms,
ADODB,
Windows,
Dialogs,
Messages,
Classes,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
var
//主框架程序变量申明
DLLApp: TApplication;
DLLScr: TScreen;
function CreateDLLForm(App: TApplication; Scr: TScreen; User: string; ADOC: TADOConnection; FormSeq: integer):TForm;
begin
case FormSeq of
1 :
begin
Application := App;
Screen := Scr;
Application.CreateForm(TForm1, Form1);
Form1.ADOQuery1.Connection := ADOC;
result := Form1;
end;
2 :
begin
Application := App;
Screen := Scr;
Application.CreateForm(TForm2 , Form2);
Form2.ADOQuery1.Connection := ADOC;
result := Form2;
end;
end;
end;
procedure ExitDLL(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
Application := DLLApp;
Screen := DLLScr;
end;
end;
exports
CreateDLLForm;
begin
DLLApp := Application;
DLLScr := Screen;
DLLProc := @ExitDLL;
end.