library ProjectDll;
uses
Windows,
Messages,
SysUtils,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
UnitDll in 'UnitDll.pas' {Form1};procedure ProvaChild(ParentApplication: TApplication; ParentForm: TForm); export; stdcall;
var
Form1: TForm1;
DllProc: Pointer; { Called whenever DLL entry point is called }begin
Application:=ParentApplication; Form1:=TForm1.Create(ParentForm);
Form1.MyParentForm:=ParentForm;
Form1.MyParentApplication:=ParentApplication;
Form1.Show;
end;procedure DLLUnloadProc(Reason: Integer); register;
begin
if Reason = DLL_PROCESS_DETACH then Application:=DllApplication;
end;exports
ProvaChild;begin
DllApplication:=Application;
DLLProc := @DLLUnloadProc;
end.
uses
Windows,
Messages,
SysUtils,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
UnitDll in 'UnitDll.pas' {Form1};procedure ProvaChild(ParentApplication: TApplication; ParentForm: TForm); export; stdcall;
var
Form1: TForm1;
DllProc: Pointer; { Called whenever DLL entry point is called }begin
Application:=ParentApplication; Form1:=TForm1.Create(ParentForm);
Form1.MyParentForm:=ParentForm;
Form1.MyParentApplication:=ParentApplication;
Form1.Show;
end;procedure DLLUnloadProc(Reason: Integer); register;
begin
if Reason = DLL_PROCESS_DETACH then Application:=DllApplication;
end;exports
ProvaChild;begin
DllApplication:=Application;
DLLProc := @DLLUnloadProc;
end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TForm1 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
MyParentForm: TForm;
MyParentApplication: TApplication;
end;var
DllApplication: TApplication;implementation{$R *.DFM}procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
// Application:=DllApplication;
end;end.
以下是 unitdll.dfm的内容:
object Form1: TForm1
Left = 192
Top = 107
Width = 317
Height = 276
Caption = 'Dll Child Form'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsMDIChild
OldCreateOrder = False
Position = poDefault
Visible = True
OnClose = FormClose
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
end
看不懂啊,能说明白点吗?我很菜的
究竟DLL 里面如何使用ADO控件连接上ACCESS数据库啊??
能帮帮我吗?