該窗體所要完成的任務是調用該dll的程序向窗體輸入要鏈接的數據表的表名
(
unit dllForm;
interface
uses
Windows
Dialogs
type
TdllSec = class(TForm)
ADOTable
DBGrid
DataSource
procedure DBGrid
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
//此函數負責取得當前應用程序的句柄並顯示窗體
function showdllform(Ahandle:Thandle;Acaption:string;tablename:string):string;stdcall;
var
//用此變量向調用dll的程序返回值
resultstr:string;
implementation
{$R *
function showdllform(Ahandle:Thandle;Acaption:string;tablename:string):string;stdcall;
var
newform:Tdllsec;
begin
//取得句柄
application
//建立窗體
newform:=Tdllsec
newform
//建立數據庫鏈接
newform
newform
//顯示窗體
try
newform
//返回雙擊所選擇的結果
result:=resultstr;
//釋放該窗體
finally newform
end;
end;
//
procedure TdllSec
begin
resultstr:=dbgrid
close;
end;
//
procedure TdllSec
var
i:integer;
begin
for i:=
dbgrid
end;
end
此時按F
圖
這是因為調試
但是實際上
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/25024.html