delphi動態呼叫dll窗體

2021-06-07 15:27:45 字數 1015 閱讀 6511

//宣告

tshowform=function (ahandle:thandle;acaption:pchar):boolean;stdcall;

//呼叫

procedure tform1.n5click(sender: tobject);

var mainfrm,dllform:thandle;

showform:tshowform;

begin

mainfrm:=form1.handle;

dllform:=loadlibrary('jsj.dll');

try

begin

if dllform<>0 then

begin

@showform:=getprocaddress(dllform,'showform');

showform(mainfrm,'進售價');

end

else

begin

raiselastwin32error;

end;

end;

finally

freelibrary(dllform);

end;

end;

//dll動態鏈結庫

function showform(ahandle:thandle;acaption:pchar):boolean;stdcall;

var aform:tform1;

begin

result:=false;

try

aform.caption:=acaption;

aform.showmodal;

result:=true;

finally

aform.free;

end;

end;

exports

showform;

begin

end.

DELPHI中動態呼叫dll

顯式例子 unit main inte ce uses windows,messages,sysutils,variants,classes,graphics,controls,forms,dialogs,stdctrls,extctrls,grids,dbgrids,db,dbtables,dbc...

Delphi 動態與靜態呼叫DLL

摘要 本文闡述了 windows 環境下動態鏈結庫的概念和特點,對靜態呼叫和動態呼叫兩種呼叫方式作出了比較,並給出了 delphi 中應用動態鏈結庫的例項。一 動態鏈結庫的概念 動態鏈結庫 dynamic link library 縮寫為 dll 是乙個可以被其它應用程式共享的程式模組,其中封裝了一...

Delphi生成即呼叫帶窗體的Dll

建立簡單的帶窗體的dll delphi7.0 file new other dll wizard,新建dll工程,file new form在dll工程中新增form窗體。另存工程為frmdll.dpr和formdll.pas。先給出 frmdll.dpr library frmdll uses s...