Delphi生成即呼叫帶窗體的Dll

2021-06-26 20:44:44 字數 1167 閱讀 8004

建立簡單的帶窗體的dll(delphi7.0):

file>>new>>other>>dll wizard,新建dll工程,file>>new>>form在dll工程中新增form窗體。另存工程為frmdll.dpr和formdll.pas。

先給出**:

frmdll.dpr**:

library frmdll;

uses

sysutils,

classes,

forms,

formdll in 'formdll.pas' ;

function getdllform:tform;stdcall;export;//定義匯出方法;

begin

result:=frmdll; //函式返回型別為乙個窗體;

end;

exports

getdllform;//宣告可匯出的方法;

begin

end. /

formdll.pas**:

///

工程**如下:

unit testdll;

inte***ce

uses

windows, messages, sysutils, variants, classes, graphics, controls, forms,

dialogs, stdctrls;

type

tform1 = class(tform)

button1: tbutton;

procedure button1click(sender: tobject);

private

public

end;

varform1: tform1;

function getdllform:tform;

implementation

function getdllform:tform;external 'frmdll.dll';  //宣告從函式frmdll.dll中呼叫函式

procedure tform1.button1click(sender: tobject);

varaform:tform;

begin

aform:=getdllform;

aform.show;

end;

end.

delphi動態呼叫dll窗體

宣告 tshowform function ahandle thandle acaption pchar boolean stdcall 呼叫 procedure tform1.n5click sender tobject var mainfrm,dllform thandle showform t...

Delphi 呼叫VC生成的DLL

1.在vc中新建乙個 dll 工程。寫如 如 extern c int npn int m,int n 編譯生成 dll 檔案。2。在delphi 中申明 function getpplength integer cdecl external dll.dll function npn m integ...

Delphi 呼叫VC生成的DLL

1.在vc中新建乙個 dll 工程。寫如 如 extern c int npn int m,int n 編譯生成 dll 檔案。2。在delphi 中申明 function getpplength integer cdecl external dll.dll function npn m integ...