您的位置:首页 > 编程语言 > Delphi

delphi 开发扩展(二)

2009-11-03 11:44 253 查看
library plug_in;

uses
SysUtils,
Classes,
Unit3 in 'H:\test\Unit3.pas' {Form3};

exports GetForm,GetName;

{$R *.res}

begin
end.

{要加载的窗体}

unit Unit3;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ADODB, DB, Grids, DBGrids;

type
TForm3 = class(TForm)
Button1: TButton;
ADOQuery1: TADOQuery;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form3: TForm3;
ADO: TADOConnection;

function GetName:string;StdCall;
function GetForm(AHandle:THandle;adoconn:TADOConnection;ACaption:String):BOOL;StdCall;

implementation

{$R *.dfm}

function GetName:string;
begin
result:='my dll';
end;

function GetForm(AHandle:THandle;adoconn:TADOConnection;ACaption:String):BOOL;
var
ShowForm:TForm3;
begin
Application.Handle:=AHandle;
ADO:= adoconn;
ShowForm :=TForm3.Create(Application);
try
if ACaption<>'' then
ShowForm.Caption:=ACaption;
ShowForm.ShowModal;
Result:=False;
finally
ShowForm.Free;
end;
end;

procedure TForm3.Button1Click(Sender: TObject);
begin
self.ADOQuery1.Connection:=ADO;
with self.ADOQuery1 do
begin
Connection:=ADO;
close;
SQL.Clear;
SQL.Add('select top 1 * from master');
open;
end;
end;

end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: