就一个form的调用呀,放了几个控件,没用到什么资源呀
dll 文件
library Pdll1;
{ 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,
Windows,
SysUtils,
Classes,
Controls,
ExtCtrls,
Udll1 in 'Udll1.pas' {Form1},
Udata in 'Udata.pas' {DataModule1: TDataModule};
{$R *.res}
function Createform(PCtrl : TWinControl): Boolean;safecall;stdcall;
begin
if pctrl <> nil then
begin
Form1 := TForm1.Create(PCtrl);
Form1.ParentFont := False;
Form1.ParentWindow := PCtrl.Handle;
SetActiveWindow(PCtrl.Handle);
Form1.Show;
end;
end;
procedure getform1;stdcall;
begin
form1.Close;
end;
exports
Createform,//2.函数输出口定义
getform1;
begin
end.
------dll 里面的form 文件
unit Udll1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls,ShareMem, ActiveX,Grids, DBGrids, ComCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.sql.Text := 'select * from folder_user ';
adoquery1.Open;
end;
initialization
CoInitialize(nil);
finalization
CoUnInitialize;
end.