首页上一页 1 下一页尾页 1 条记录 1/1页
delphi bpl+dll共享数据库链接
发表在其他语言图书答疑区
2022-07-06 悬赏:10 学分
是否精华
是
否
版块置顶:
是
否
我这里有个例子不懂,是涉及到bpl+dll方式,dll里面的窗体共享bpl数据链接的,是之前的delphi编程词典>方案资源库>业务窗体封装设计方案 >BPL+DLL业务窗体封装设计方案>1.6.3 里面的例子
不太懂的是dll里面的窗体,FrmCustSeek>ADODataSet1如何获得了bpl包里的数据库链接.
unit OutFunction; interface uses forms, Windows, Classes,ActiveX; function GetFormClass(FormClass: string): TFormClass;stdcall; implementation uses FormCustSeek; exports GetFormClass; function GetFormClass(FormClass: string): TFormClass;stdcall; begin Result := TFormClass(GetClass(FormClass)); end; initialization CoInitialize(nil); RegisterClass(TFrmCustSeek); finalization UnRegisterClass(TFrmCustSeek); CoUninitialize; end.
unit FormCustSeek; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls, ExtCtrls; type TFrmCustSeek = class(TForm) DBGrid1: TDBGrid; ADODataSet1: TADODataSet; DataSource1: TDataSource; Panel1: TPanel; Button3: TButton; procedure FormCreate(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } end; var FrmCustSeek: TFrmCustSeek; implementation uses DataModule; {$R *.dfm} procedure TFrmCustSeek.FormCreate(Sender: TObject); begin ADODataSet1.Active := False; ADODataSet1.Active := True; end; procedure TFrmCustSeek.Button3Click(Sender: TObject); begin Close; end; procedure TFrmCustSeek.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; end.